使用 Office 365 使用 Swift 邮件程序发送邮件时出现问题
Problem in Send Mail using Swift Mailer using Office 365
我尝试了 Swift-mailer 服务来发送邮件.. 我的组织使用 Outlook 365。
下面是配置。
$transport = (new \Swift_SmtpTransport('outlook.office365.com', 587,'tls'))
但我收到身份验证错误
我在 gmail 中试过。有效 fine.port 我试过的号码是 587 和 443.. 两者都显示身份验证错误。有什么想法吗?
$transport = (new \Swift_SmtpTransport('smtp.office365.com', 587,'tls'))
使用 1 个可能的身份验证器无法在用户名为 "Username@Organization.com" 的 SMTP 服务器上进行身份验证。身份验证器登录返回预期响应代码 235 但得到代码“535”,消息“535 5.7.3 身份验证不成功 [MAXPR0101CA0037.INDPRD01.PROD.OUTLOOK.COM]
".
您使用的是 symfony 还是独立使用的库?
我很确定即使是单机版也需要这部分:
mailer_transport: smtp
mailer_host: smtp.office365.com
mailer_port: 587
mailer_user: some-user@domain.tld
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(['john@doe.com' => 'John Doe'])
->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself')
;
// Send the message
$result = $mailer->send($message);
我尝试了 Swift-mailer 服务来发送邮件.. 我的组织使用 Outlook 365。
下面是配置。
$transport = (new \Swift_SmtpTransport('outlook.office365.com', 587,'tls'))
但我收到身份验证错误 我在 gmail 中试过。有效 fine.port 我试过的号码是 587 和 443.. 两者都显示身份验证错误。有什么想法吗?
$transport = (new \Swift_SmtpTransport('smtp.office365.com', 587,'tls'))
使用 1 个可能的身份验证器无法在用户名为 "Username@Organization.com" 的 SMTP 服务器上进行身份验证。身份验证器登录返回预期响应代码 235 但得到代码“535”,消息“535 5.7.3 身份验证不成功 [MAXPR0101CA0037.INDPRD01.PROD.OUTLOOK.COM] ".
您使用的是 symfony 还是独立使用的库?
我很确定即使是单机版也需要这部分:
mailer_transport: smtp
mailer_host: smtp.office365.com
mailer_port: 587
mailer_user: some-user@domain.tld
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(['john@doe.com' => 'John Doe'])
->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself')
;
// Send the message
$result = $mailer->send($message);