Created
February 27, 2017 18:51
-
-
Save MikeiLL/7bf5f6d840a8cdde775f6a8ec97682db 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('../lists/admin/PHPMailer/PHPMailerAutoload.php'); | |
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded | |
$mail = new PHPMailer(); | |
$body = file_get_contents('contents.html'); | |
$body = eregi_replace("[\]",'',$body); | |
$mail->IsSMTP(); // telling the class to use SMTP | |
$mail->Host = "mail.madhappy.com"; // SMTP server | |
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing) | |
// 1 = errors and messages | |
// 2 = messages only | |
$mail->SMTPAuth = true; // enable SMTP authentication | |
$mail->SMTPSecure = "tls"; // sets the prefix to the servier | |
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server | |
$mail->Port = 587; // set the SMTP port for the GMAIL server | |
$mail->Username = "email"; // GMAIL username | |
$mail->Password = "password"; // GMAIL password | |
$mail->SetFrom('[email protected]', 'Mike iLL'); | |
$mail->AddReplyTo('[email protected]', 'Mike iLL'); | |
$mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic"; | |
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test | |
$mail->MsgHTML($body); | |
$address = "[email protected]"; | |
$mail->AddAddress($address, "First Last"); | |
//$mail->AddAttachment("images/phpmailer.gif"); // attachment | |
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment | |
if(!$mail->Send()) { | |
echo "Mailer Error: " . $mail->ErrorInfo; | |
} else { | |
echo "Message sent!"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment