Created
February 7, 2016 20:44
-
-
Save himstar/b6ac9dd00b1b568b8dfc to your computer and use it in GitHub Desktop.
Mandrill Smtp PhpMailer Easy
This file contains 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 | |
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