0
虽然从YII发送邮件,支持SMTP协议,它提供了以下错误:Yii的SMTP邮件发送失败了office365主机
Swift_TransportException: Expected response code 250 but got code "530", with message "530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [BM1PR01CA0097.INDPRD01.PROD.OUTLOOK.COM] " in /var/www/html/vvf.kritva.in/protected/extensions/yii-mail/vendors/swiftMailer/classes/Swift/Transport/AbstractSmtpTransport.php:406
即使端口更改为587,它给了同样的错误。
'transportType' => 'smtp',
'transportOptions' => array(
'host'=>'smtp.office365.com',
'username'=>'[email protected]',
'password'=>'password',
'port'=>'587',
// 'encryption' => 'tls'
),
在控制器的代码如下:
$message = new YiiMailMessage;
$message->setBody('Message content here with HTML', 'text/html');
$message->subject = 'xyz';
$message->addTo('[email protected]');
$message->from = '[email protected]';
Yii::app()->mail->send($message);
请帮助解决这个问题,。
在此先感谢。
请检查我的代码如下: 'transportType'=> 'SMTP', \t \t \t 'transportOptions'=>数组( \t \t \t '主机'=> 'smtp.office365.com', '用户名 '=>' 用户名”, '密码'=> '密码', '口'=> '587', // '加密'=> 'TLS' \t \t \t), – monica
你好,请提供您如何发送此电子邮件的代码。 – Yupik
我在yii中使用下面的代码发送邮件:Yii :: import('ext.yii-mail.YiiMailMessage'); \t \t $ message = new YiiMailMessage; \t \t $ MESSAGE-> setBody( '信息的内容在这里与HTML', 'text/html的'); \t \t $ message-> subject ='Demo'; \t \t $ MESSAGE-> AddTo就('[email protected]'); \t \t $ MESSAGE-从= '[email protected]'>; Yii :: app() - > mail-> send($ message);}} \t \t return true; \t \t}赶上(例外$ E){ \t \t回波$ë; \t \t} – monica