Swiftmailer 不起作用
Swiftmailer doesn't work
我在通过 Swiftmailer 发送邮件时遇到问题
我的参数文件是:
parameters:
mailer_transport: smtp
mailer_host: mail.myweb.cz
mailer_user: noreply@myweb.cz
mailer_password: pass
如果我将邮件发送到任何@myweb.cz 的地址,邮件就会到达。但是,如果我将邮件发送到另一个地址,例如 something@gmail.com,邮件不会到达。
服务器上的 SMTP 已设置:
server: smtp.myweb.cz
port: 587
security: STARTTLS
auth method: Normal password
在 Thunderbird 中一切正常,错误一定是在 swiftmailer 配置中。
感谢帮助
编辑:
在我的本地开发计算机上,它可以使用 Javier Eguiluz 的解决方案,但我现在在生产服务器上遇到错误:
app.ERROR:刷新电子邮件队列时发生异常:无法连接 TLS 加密。
但是如果我尝试通过 telnet 从任何其他计算机使用 STARTTLS 连接到服务器,它就可以工作。
你有什么想法吗?
解决:
问题出在自签名证书中。我没有在受信任的证书中。
在我的 Gmail 配置中,我还需要将 swiftmailer encryption
选项定义为 ssl
。
也许您应该将以下内容添加到您的配置中?
parameters:
mailer_transport: smtp
mailer_host: mail.myweb.cz
mailer_port: 587
mailer_encryption: tls
mailer_user: noreply@myweb.cz
mailer_password: pass
然后在您的 app/config/config.yml
文件中也添加这些新选项:
swiftmailer:
# ...
port: %mailer_port%
encryption: %mailer_encryption%
参考:http://symfony.com/doc/current/reference/configuration/swiftmailer.html#encryption
我在通过 Swiftmailer 发送邮件时遇到问题
我的参数文件是:
parameters:
mailer_transport: smtp
mailer_host: mail.myweb.cz
mailer_user: noreply@myweb.cz
mailer_password: pass
如果我将邮件发送到任何@myweb.cz 的地址,邮件就会到达。但是,如果我将邮件发送到另一个地址,例如 something@gmail.com,邮件不会到达。
服务器上的 SMTP 已设置:
server: smtp.myweb.cz
port: 587
security: STARTTLS
auth method: Normal password
在 Thunderbird 中一切正常,错误一定是在 swiftmailer 配置中。
感谢帮助
编辑:
在我的本地开发计算机上,它可以使用 Javier Eguiluz 的解决方案,但我现在在生产服务器上遇到错误:
app.ERROR:刷新电子邮件队列时发生异常:无法连接 TLS 加密。
但是如果我尝试通过 telnet 从任何其他计算机使用 STARTTLS 连接到服务器,它就可以工作。
你有什么想法吗?
解决:
问题出在自签名证书中。我没有在受信任的证书中。
在我的 Gmail 配置中,我还需要将 swiftmailer encryption
选项定义为 ssl
。
也许您应该将以下内容添加到您的配置中?
parameters:
mailer_transport: smtp
mailer_host: mail.myweb.cz
mailer_port: 587
mailer_encryption: tls
mailer_user: noreply@myweb.cz
mailer_password: pass
然后在您的 app/config/config.yml
文件中也添加这些新选项:
swiftmailer:
# ...
port: %mailer_port%
encryption: %mailer_encryption%
参考:http://symfony.com/doc/current/reference/configuration/swiftmailer.html#encryption