使用 swiftmailer 在 symfony 2 中通过 smtp.gmail.com 发送邮件

2023-12-26

我在使用 gmail 从 xampp 本地主机发送邮件时遇到问题。经过很长一段时间我终于成功了。我正在与大家分享。如果我错了,需要适当的解决方案。

在你的 symfony 2 的 config.yml 中写下这些

swiftmailer:
    disable_delivery:  false
    transport: %mailer_transport%
    host:      %mailer_host%
    username:  %mailer_user%
    password:  %mailer_password%
    port:      %mailer_port%
    encryption: %mailer_encryption%

在你的parameters.yml中

mailer_transport: smtp
mailer_host: smtp.gmail.com
mailer_user: [email protected] /cdn-cgi/l/email-protection
mailer_password: Your_gmail_pass
mailer_port: 465 or 587
mailer_encryption:  ssl 

你可以试试这个

参数.yml

mailer_transport: gmail
mailer_encryption: ssl
mailer_auth_mode: login
mailer_host: smtp.gmail.com
mailer_user: 'xxxxxxxxxxxx'

配置.yml

swiftmailer:
   transport: gmail
   host:      smtp.gmail.com
   username:  '[email protected] /cdn-cgi/l/email-protection'
   password:  'Password'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 swiftmailer 在 symfony 2 中通过 smtp.gmail.com 发送邮件 的相关文章

随机推荐