如何在我的Zend_Mail_Transport_Smtp
中使用Amazon SES密鑰,祕密+ smtp地址? 它說:Must issue a STARTTLS command first
而試圖跟隨。如何在我的Zend_Mail_Transport_Smtp適配器中使用Amazon SES密鑰,secret + smtp地址?
/*
Reference in C#: http://sesblog.amazon.com/
String username = "SMTP-USERNAME"; // Replace with your SMTP username.
String password = "SMTP-PASSWORD"; // Replace with your SMTP password.
String host = "email-smtp.us-east-1.amazonaws.com";
int port = 25;
*/
public static function sendEmail($to, $subject, $body) {
$config = array(
'aws_key' => 'yourkey',
'aws_secret' => 'yourkeysecret',
));
//
//echo 0 > /selinux/enforce
//$tr = new Zend_Mail_Transport_Smtp('smtp.belgacom.be');// works - for local
//$tr = new Zend_Mail_Transport_Smtp('out.telenet.be'); // works - for office
//
$tr = new Zend_Mail_Transport_Smtp(
'email-smtp.us-east-1.amazonaws.com'); // DOES not work
Zend_Mail::setDefaultTransport($tr);
$mail = new Zend_Mail();
$html = self::setupEmail($body);
$mail->setBodyHtml($html);
$mail->setFrom('[email protected]', 'memy.com');
$mail->addTo($to, 'EXAMPLE');
$mail->setSubject($subject);
$mail->send();
}
追問:
// Wild guess
$config = array(
'aws_key' => 'yourkey',
'aws_secret' => 'yourkeysecret',
));
$tr = new Zend_Mail_Transport_Smtp('email-smtp.us-east-1.amazonaws.com',
$config);
末次隨訪:
步驟1)要使用亞馬遜SES SMTP接口發送電子郵件,你將需要:
AWS賬戶。
亞馬遜SES生產訪問,如果你想發送大量的電子郵件。有關更多信息,請參閱請求生產訪問。
- 這件事以後,他們允許
send 10000 emails per 24 hour period
- 這被迅速激活喜歡小於24小時
- 5封電子郵件/秒
的電子郵件地址,您已完成與亞馬遜SES。有關更多信息,請參閱驗證電子郵件地址。
- 這需要同時通過他們
驗證 - 這仍然是24小時後尚未證實
的SMTP接口的主機名和端口號。主機名是email-smtp.us-east-1.amazonaws.com。端口號因連接方式而異。有關更多信息,請參閱連接到SMTP端點。
- 否則非常重要,它是做不到這一點,你從AWS管理控制檯獲得
的SMTP用戶名和密碼。有關更多信息,請參閱SMTP憑據。
可使用TLS(傳輸層安全性)進行通信的客戶端軟件。
步驟2)我上面那些完成,在那裏管理控制檯它表明:
Status:
pending verification (resend)
Please check your inbox for an email to this address, and click on the link provided to complete verification. If you did not receive this email, please click resend.
Domain verification in AWS:
Status:
pending verification (resend)
Please check your inbox for an email to this address, and click on the link provided to complete verification. If you did not receive this email, please click resend.
,這意味着,他們將72小時
步驟3)內做一些事情在不使用外部適配器的情況下修改$ config(未由ZF移位)
$config = array(
'auth' => 'login',
'username' => 'SES key',
'password' => 'SES secret',
));
$tr = new Zend_Mail_Transport_Smtp('email-smtp.us-east-1.amazonaws.com',
$config);
「它不工作」 是一個比較含糊;)什麼是發生確切的錯誤? – dom
@YumYumYum檢查我的編輯... – dom
1)我已經完成了所有這些提到的這些http://docs.amazonwebservices.com/ses/latest/DeveloperGuide/SMTP.html?r=9608 2)我現在正在使用開始SES SMTP證書(不是AWS證書3)仍然給出了這個530 4)這是否意味着,有技術人員必須手動修改我的帳戶的東西,然後它會被激活? – YumYumYum