Home > Uncategorized > Send email via #Amazon SES via PHP using #PHPMailer

Send email via #Amazon SES via PHP using #PHPMailer

<?php
require_once(‘scripts/phpmailer/PHPMailerAutoload.php’);
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = “tls”;
$mail->Host = “email-smtp.eu-west-1.amazonaws.com”;
$mail->Port = 587;
$mail->Username = “xxxx”;
$mail->Password = “xxxx”;
$mail->CharSet = ‘windows-1250’;
$mail->SetFrom (‘info@domain.com’, ‘info@domain.com’);
$mail->Subject = “Subject line “;
$mail->ContentType = ‘text/plain’;
$mail->IsHTML(false);
$mail->Body = “this is the body”;
$mail->AddAddress (‘someone@gmail.com’, ‘Someone’);
if(!$mail->Send())
{
$error_message = “Mailer Error: ” . $mail->ErrorInfo;
} else
{
$error_message = “Successfully sent!”;
}
echo $error_message;
?>

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: