Skip to content

Instantly share code, notes, and snippets.

@emjayoh
Created February 21, 2020 22:29
Show Gist options
  • Save emjayoh/62a4d84b91c10c28c6378d449fe44889 to your computer and use it in GitHub Desktop.
Save emjayoh/62a4d84b91c10c28c6378d449fe44889 to your computer and use it in GitHub Desktop.
<?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