2014-05-01 91 views
1

你好,我有这个代码发送邮件,但邮件没有发送。我无法从在线服务器发送邮件,但我可以在本地发送邮件。可能是什么问题?集成PHPmailer与Ec2

$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!"; 
} 
+0

产生的任何错误? – Undo

回答

1

我要带刺的,说你可能丢失你的电子邮件地址[email protected]在亚马逊SES验证的电子邮件地址。

您可以从AWS SES控制台做到这一点:

SES Verify Email