如何在我的Zend_Mail_Transport_Smtp
中使用Amazon密钥,秘密+ smtp地址?它说:Must issue a STARTTLS command first
,同时尝试跟随。
/*
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('support@memy.com', '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)若要使用Amazon接口发送电子邮件,您将需要以下内容:
send 10000 emails per 24 hour period
-这很快就被激活了,就像不到24小时
-5封电子邮件/秒步骤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);
发布于 2012-06-15 10:20:56
我想最简单的方法是使用这个外接程序:亚马逊-SES-Zend-邮件-传输。另一方面,如果您通过Zend_Mail_Transport挖掘自己,您可以自己编写它。
编辑
Response: 530 Must issue a STARTTLS command first
意味着您需要在进行身份验证之前启用安全连接。
还请确保在通过SMTP进行连接时使用的是SMTP凭据。这些凭据与AWS凭据不同。从您发布的代码来看,您可能正在使用AWS凭据。
并检查github上提供的自述文件;)
编辑2
尝试将此添加到您的配置中:
$config = array('ssl' => 'tls','port' => 25);
编辑3
554 Message rejected: Email address is not verified
出现,甚至地址已被验证。一些想法,为什么它不起作用:
1.)验证的地址区分大小写,因此,如果您将其用于与验证不同的情况,则会遇到问题。这可以归结为对rfc的严格解释。->检查此
2.)我认为亚马逊不喜欢像admin@yourdomain.com ->这样基于角色的地址检查这个
发布于 2012-12-23 20:04:38
我被“554条消息拒绝了:电子邮件地址没有被验证”,但是对/etc/php.ini的编辑为我修复了它:
sendmail_path = /usr/sbin/sendmail -t -i -f someone@yourdomain.com
信贷:http://www.petermac.com/php-mail-function-with-postfix/
发布于 2013-03-07 14:16:56
又一次跟进。
为了帮助其他人解决同样的问题,下面是我最近用来让这个程序正确工作的确切步骤。
首先使用这个https://github.com/christophervalles/Amazon-SES-Zend-Mail-Transport
然后这个:
$mail = new Zend_Mail('utf-8');
$transport = new App_Mail_Transport_AmazonSES(
array(
'accessKey' => 'YOUR_ACCESS_KEY',
'privateKey' => 'YOUR_PRIVATE_KEY'
)
);
$mail->addTo('destination@example.com', 'Recipient')
->setFrom('your.verified.email@gmail.com', 'Webmaster')
->setSubject('Email subject line')
->setBodyText('Email body')
->send($transport);
有关更多细节和可能的错误:framework.html
https://stackoverflow.com/questions/11047645
复制相似问题