Reputation: 11
Hello I have this code to send mail but mail is not getting sent. I can not send mail from the online server but I can send mail locally. What could be the issue?
$mail = new \Core\mailer\Phpmailer();
$mail->IsSMTP(); // we are going to use SMTP
$mail->SMTPAuth = true; // enabled SMTP authentication
$mail->SMTPSecure = "tls";
$mail->Host = "email-smtp.eu-west-1.amazonaws.com";
$mail->Port = 587; // SMTP port to connect to GMail
$mail->Username = "******"; // user email address
$mail->Password = "*********"; // password in GMail
$mail->SetFrom('[email protected]', 'IROKING'); //Who is sending the email
$mail->AddReplyTo('[email protected]', 'iROKING Registration');
$mail->Subject = 'Registration on iROKING';
$mail->Body = $body;
$mail->AltBody = "Plain text message";
$destination = $to; // Who is addressed the email to
$mail->AddAddress($destination, "");
if(!$mail->Send()) {
echo "Error: " . $mail->ErrorInfo;
} else {
echo "Message sent correctly!";
}
Upvotes: 1
Views: 1120
Reputation: 61641
I'm gonna take a stab at and say that you are probably missing your email address [email protected]
as a verified email address in Amazon SES.
You can do it from AWS SES console:
Upvotes: 1