swiftmailer 使用带有自定义域的 gmail 发送电子邮件 [英] swiftmailer send email using gmail with custom domain

查看:32
本文介绍了swiftmailer 使用带有自定义域的 gmail 发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 symfony2.3 中,我使用的是 swiftmailer.

In symfony2.3 I am using swiftmailer.

我有一个像 myname@abc.com 这样的 Google Apps 地址和我的普通 gmail 地址 myname@gmail.com

I have a Google Apps address like myname@abc.com and my normal gmail address myname@gmail.com

使用时:

mailer_transport:  smtp
mailer_encryption: ssl
auth_mode:         login
mailer_host:       smtp.gmail.com
mailer_user:       myname
mailer_password:   pymass

配置效果很好,它从我的 gmail 地址发送电子邮件,但使用 myname@abc.com 作为 mailer_user 和正确的密码不起作用.

the configuration works great and it sends emails from my gmail address but using myname@abc.com as mailer_user with correct password doesn't work.

有什么想法吗?

推荐答案

从(我假设是)Google Apps 帐户发送的配置不同于 Gmail 帐户.您的 swiftmailer 参数应如下所示:

The configuration for sending from (what I assume is) a Google Apps account differs from a Gmail account. Your swiftmailer parameters should look something like this:

mailer_transport:  smtp
mailer_host:       smtp.gmail.com
mailer_user:       myname@abc.com
mailer_password:   pymass
auth_mode:         login
port:              587
encryption:        tls

确保包含您的整个电子邮件地址以及端口和加密协议.

Make sure to include your entire email address as well as the port and encryption protocol.

我从这篇文章中得出了解决方案 几个月前.

还有一个小提示:它的 encryption 不是 mailer_encyption.您可以在此处阅读有关 Symfony 的 swiftmailer 参数的更多信息.

Also, a small note: its encryption not mailer_encyption. You can read more about the swiftmailer parameters for Symfony here.

这篇关于swiftmailer 使用带有自定义域的 gmail 发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆