2015-03-02 19 views
8

Amazon SES hizmetinde, PHP Posta kullanarak php postası üzerinden posta göndermek istiyorum Ama gönderemiyorum. E-posta adresimi zaten doğruladım. Bu eğiticiyi http://www.codeproject.com/Articles/786596/How-to-Use-Amazon-SES-to-Send-Email-from-PHP referansı olarak kullanıyorum. Ama Amazon SES hizmetlerinden posta göndermiyor, lütfen bana nerede yanlış olduğumu söyle? Önceden, localserver XAMPP'den posta göndermek için aynı kimliği kullanıyordum. Çalışıyordu.Amazon SES hizmetinde nasıl posta yoluyla posta gönderilir?

sendMail.php

<?php > 
function Send_Mail($to,$subject,$body) 
{ 
    require 'class.phpmailer.php'; 
    $from = "Senders_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 = "Senders_Email_Address"; // SMTP Username 
    $mail->Password = "MyPassword"; // SMTP Password 
    $mail->SetFrom($from, 'From Name'); 
    $mail->AddReplyTo($from,'Senders_Email_Address'); 
    $mail->Subject = $subject; 
    $mail->MsgHTML($body); 
    $address = $to; 
    $mail->AddAddress($address, $to); 
    if(!$mail->Send()) 
     return false; 
    else 
     return true; 
} 
?> 

İndex.php sendMail.php, class.phpmailer.php, class.smtp.php ve index.php olan

<html> 
<body>  
<h1>Welcome to my home page!</h1> 
<p>Some text.</p> 
<p>Some more text.</p> 
<?php 
require 'sendMail.php'; 
$to = "Senders_Email_Address"; 
$subject = "Test Mail Subject"; 
$body = "Hi<br/>Test Mail<br/>Amazon SES"; // HTML tags 
Send_Mail($to,$subject,$body); 
?> 

</body> 
</html> 

aynı dizin.

cevap

6

Neelabh, bir şeyleri kaçırıyorsunuz. aşağıdakileri deneyin:

<?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; 

} 
?> 

Ayrıca aşağıdaki gibi bir dizin dosyası oluşturmak:

<?php 
require 'Send_Mail.php'; 
$to = "[email protected]"; 
$subject = "Test Mail Subject"; 
$body = "Hi<br/>Test Mail<br/>Amazon SES"; // HTML tags 
Send_Mail($to,$subject,$body); 
?> 

Eğer SES sadece sanal erişimi varsa, o zaman alıcı e-posta adresi de doğrulanması gerekir lütfen unutmayın. veya alanınızı doğrulayabilirsiniz. Bu işe yararsa bana bildirin.

+0

[class.php.mailer] sayfasını indirmek için buraya tıklayın (http://www.johnboy.com/blog/sending-email-with-amazon-ses-smtp-and-phpmailer) – Mark

İlgili konular