Nilabh, you are missing something. try the following:
<?php > function Send_Mail($to,$subject,$body) { require 'class.phpmailer.php'; $from = "verified_email address"; $mail = new PHPMailer(); $mail->IsSMTP(true); // SMTP $mail->SMTPAuth = true; // SMTP authentication $mail->Mailer = "smtp"; $mail->Host= "tls://email-smtp.us-east.amazonaws.com"; // Amazon SES $mail->Port = 465; // SMTP Port $mail->Username = "Your_SMTP_Username "; // SMTP Username $mail->Password = "SMTP_Password"; // SMTP Password $mail->SetFrom($from, 'From Name'); $mail->AddReplyTo($from,'yourdomain.com or verified email address'); $mail->Subject = $subject; $mail->MsgHTML($body); $address = $to; $mail->AddAddress($address, $to); if(!$mail->Send()) return false; else return true; } ?>
Also create an index file as shown below:
<?php require 'Send_Mail.php'; $to = "to@gmail.com"; $subject = "Test Mail Subject"; $body = "Hi<br/>Test Mail<br/>Amazon SES"; // HTML tags Send_Mail($to,$subject,$body); ?>
Please note that if you only have access to the SES sandbox, you also need to check the recipient's email address. or you can check your domain. let me know if that works.
Vikram Vishal
source share