我尝试了Swift-mailer服务发送邮件...我的组织使用Outlook 365。下面是配置。$transport = (new \Swift_SmtpTransport('outlook.office365.com', 587,'tls'))
但我得到的认证错误我试过在Gmail.工作正常.端口号,我试过是587以及443 ......都显示认证错误。有什么办法吗?
$transport = (new \Swift_SmtpTransport('smtp.office365.com', 587,'tls'))
在SMTP服务器上用用户名 "[email protected] "使用1个可能的验证器验证失败。认证器LOGIN返回预期响应代码235,但得到代码 "535",并显示 "535 5.7.3 Authentication unsuccessful [MAXPR0101CA0037.INDPRD01.PROD.OUTLOOK.COM]"。
你是使用symfony还是使用独立的库?
我敢肯定,即使是单机版也需要这部分。
mailer_transport: smtp
mailer_host: smtp.office365.com
mailer_port: 587
mailer_user: [email protected]
mailer_password: some-password
mailer_encryption: tls
mailer_delivery_adress: some-email-adress-here
根据快速查看他们的文档
// Create the Transport
$transport = (new Swift_SmtpTransport('smtp.office365.com', 587))
->setUsername('your username')
->setPassword('your password')
;
// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
// Create a message
$message = (new Swift_Message('Wonderful Subject'))
->setFrom(['[email protected]' => 'John Doe'])
->setTo(['[email protected]', '[email protected]' => 'A name'])
->setBody('Here is the message itself')
;
// Send the message
$result = $mailer->send($message);