Skip to content

Instantly share code, notes, and snippets.

@himstar
Created February 7, 2016 20:44
Show Gist options
  • Save himstar/b6ac9dd00b1b568b8dfc to your computer and use it in GitHub Desktop.
Save himstar/b6ac9dd00b1b568b8dfc to your computer and use it in GitHub Desktop.
Mandrill Smtp PhpMailer Easy
<?php
include ("lib/PHPMailerAutoload.php");
$sen_name = "";
$sen_email = "";
$rec_email = "";
$email_sub = "";
$box_msg = "";
$mail = new PHPMailer();
// Telling the class to use SMTP
$mail->IsSMTP();
$mail->Mailer = "smtp";
$mail->Host = "smtp.mandrillapp.com";
$mail->Port = 587;
// Turn on SMTP authentication
$mail->SMTPAuth = true;
// SMTP Username
$mail->Username = "";
// SMTP Password ( i.e. Any valid Mandrill API key)
$mail->Password = "";
$rec_email = ""; // Your email address will be here
$sen_name = $_POST[name];
$email_sub = ""; // Your email subject will be here
$sen_email = ""//$_POST[email];
$box_msg = ""//$_POST[message];
$mail->From = $sen_email;
$mail->FromName = $sen_name;
$mail->AddAddress($rec_email);
$mail->Subject = $email_sub;
$mail->Body = $box_msg;
$mail->WordWrap = 50;
if (($sen_email != "") && ($rec_email != "" )) {
// Sending Email
$status = $mail->Send();
echo"Email Sent !";
}
else
{
echo"<p>The mail() function failed.</p>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment