Created
February 21, 2020 22:29
-
-
Save emjayoh/62a4d84b91c10c28c6378d449fe44889 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once "Mail.php"; | |
| $from = "[email protected]"; | |
| $to = '[email protected]'; | |
| $host = "ssl://smtp.gmail.com"; | |
| $port = "465"; | |
| $username = '[email protected]'; | |
| $password = 'mypassword'; | |
| $subject = "test"; | |
| $body = "test"; | |
| $headers = array ('From' => $from, 'To' => $to,'Subject' => $subject); | |
| $smtp = Mail::factory('smtp', | |
| array ('host' => $host, | |
| 'port' => $port, | |
| 'auth' => true, | |
| 'username' => $username, | |
| 'password' => $password)); | |
| $mail = $smtp->send($to, $headers, $body); | |
| if (PEAR::isError($mail)) { | |
| echo($mail->getMessage()); | |
| } else { | |
| echo("Message successfully sent!\n"); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment