Skip to content

Instantly share code, notes, and snippets.

@LinuxPhreak
Last active December 21, 2015 02:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LinuxPhreak/6237657 to your computer and use it in GitHub Desktop.
Save LinuxPhreak/6237657 to your computer and use it in GitHub Desktop.
SMS Sender
require_once '../class.phpmailer.php';
$results_messages = array();
$mail = new PHPMailer(true);
$mail->CharSet = 'utf-8';
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->Host = "smtp.gmail.com";
$mail->Port = "587";
$mail->SMTPSecure = "ssl";
$mail->SMTPAuth = true;
$mail->Username = "someemail@gmail.com";
$mail->Password = "mypassword";
$mail->AddReplyTo("my@gmail.com", "Ben");
$mail->From = "my@gmail.com";
$mail->FromName = "Ben";
$mail->AddAddress($number . $gateway, "Customer");
$mail->Subject = "Hello";
$body = <<<'EOT'
Hello
EOT;
$mail->WordWrap = 80;
$mail->MsgHTML($body, dirname(__FILE__), true); //Create message bodies and embed images
$mail->AddAttachment('images/phpmailer_mini.gif', 'phpmailer_mini.gif'); // optional name
$mail->AddAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name
}
catch (phpmailerAppException $e) {
$results_messages[] = $e->errorMessage();
}
if (count($results_messages) > 0) {
echo "<h2>Run results</h2>\n";
echo "<ul>\n";
foreach ($results_messages as $result) {
echo "<li>$result</li>\n";
}
echo "</ul>\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment