Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once "Mail.php";
- $from = "IsmAvatar@gmail.com";
- $to = "IsmAvatar <IsmAvatar@gmail.com>";
- $subject = "Test";
- $body = "This is just a test";
- // stick your GMAIL SMTP info here! ------------------------------
- $host = "ssl://smtp.google.com";
- $port = "465"; //or 587
- $username = "IsmAvatar@gmail.com";
- $password = "password";
- // --------------------------------------------------------------
- $headers = array ('From' => $from,
- 'To' => $to,
- 'Subject' => $subject);
- $smtp = Mail::factory('smtp',
- array ('host' => $host,
- 'port' => $port,
- 'auth' => true,
- 'debug' => true,
- 'username' => $username,
- 'password' => $password));
- $mail = $smtp->send($to, $headers, $body);
- if (PEAR::isError($mail)) {
- echo('<p>' . $mail->getMessage() . "</p>\n");
- //Failed to connect to ssl://smtp.google.com:465 [SMTP: Failed to connect socket: Connection timed out (code: -1, response: )]
- } else {
- echo("<p>Message successfully sent!</p>\n");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement