Sta*_*cka 0 email swiftmailer symfony
我有通过Swiftmailer发送邮件的问题
我的参数文件是:
parameters:
mailer_transport: smtp
mailer_host: mail.myweb.cz
mailer_user: noreply@myweb.cz
mailer_password: pass
Run Code Online (Sandbox Code Playgroud)
如果我用any@myweb.cz发送邮件到地址,邮件就会到达.但是,如果我将邮件发送到另一个地址,例如something@gmail.com,邮件就不会到达.
设置服务器上的SMTP:
server: smtp.myweb.cz
port: 587
security: STARTTLS
auth method: Normal password
Run Code Online (Sandbox Code Playgroud)
在Thunderbird正常情况下,错误必须在swiftmailer配置中.
感谢帮助
编辑:
在我的本地开发计算机上它可以解决来自Javier Eguiluz,但我现在在prod服务器上有错误:
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
Run Code Online (Sandbox Code Playgroud)
然后在您的app/config/config.yml文件中添加这些新选项:
swiftmailer:
# ...
port: %mailer_port%
encryption: %mailer_encryption%
Run Code Online (Sandbox Code Playgroud)
参考:http://symfony.com/doc/current/reference/configuration/swiftmailer.html#encryption