Php Symfony2:尝试使用Swiftmailer发送电子邮件时出错
当我试图用swift发送电子邮件时,我遇到了以下问题: Symfony2项目:刷新电子邮件队列时发生异常:预期响应代码为220,但获得代码“”,带有消息“” 我在localhost中,我尝试使用我的主机OVH的邮件。以下是我的config.yml:Php Symfony2:尝试使用Swiftmailer发送电子邮件时出错,php,symfony,swiftmailer,Php,Symfony,Swiftmailer,当我试图用swift发送电子邮件时,我遇到了以下问题: Symfony2项目:刷新电子邮件队列时发生异常:预期响应代码为220,但获得代码“”,带有消息“” 我在localhost中,我尝试使用我的主机OVH的邮件。以下是我的config.yml: # Swiftmailer Configuration swiftmailer: transport: "%mailer_transport%" auth_mode: "%mailer_auth_mode%" host:
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
auth_mode: "%mailer_auth_mode%"
host: "%mailer_host%"
port: "%mailer_port%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
和my parameters.yml:
# This file is auto-generated during the composer install
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: null
database_name: ********
database_user: root
database_password: null
mailer_transport: mail
mailer_auth_mode: login
mailer_host: ns0.ovh.net
mailer_port: 587
mailer_user: contact@******.com
mailer_password: **********
locale: fr
secret: ThisTokenIsNotSoSecretChangeIt
谢谢你你安装了什么版本的SwiftMailer?SwiftMailer 5.4.5不推荐使用邮件传输
从SWIFTMail 5.4.5开始,邮件传输被禁止,将在版本6中删除。考虑使用另一种传输方式,如SMTP、SeNail或Gmail。
您可以通过以下链接查看更多信息: 您需要更改邮件传输
。尝试此配置,编辑端口、加密、主机
参数.yml
parameters:
mailer_transport: smtp
mailer_host: smtp.example.com
mailer_user: user@example.com
mailer_password: my_password
mailer_port: 587
mailer_encryption: tls