Google App-Gmail 无法设置。通过 swiftmailer SMTP 传输 (PHP) 发送时 Gmail 替换地址
您好,感谢您提前提供的任何帮助。
我正在使用 swiftmailer、SMTP 传输方法从我的 PHP 脚本发送电子邮件。
发送消息就好了。有用。
问题是,无论我将 FROM、REPLYTO、SENDER 设置设置为什么,电子邮件都会作为 GMAIL 邮箱发送(ME - [电子邮件受保护])。
$transport = Swift_SmtpTransport::newInstance('imap.gmail.com', 465,'ssl')
->setUsername($login)
->setPassword($password)
;
$message = Swift_Message::newInstance($subject)
->setFrom(array('[email protected]' => 'test mcttest'))
->setReplyTo(array('[email protected]' => 'test mcttest'))
->setSender('[email protected]')
->setTo(array($to))
->setBody(wordwrap($body, 70))
->setContentType('text/plain')
;
因此,电子邮件顺利通过,但不是来自 [电子邮件受保护]< /a> 作为发件人...它[电子邮件受保护]
我切换到一个单独的(非 gmail)SMTP 服务器进行测试,电子邮件顺利通过,没有任何问题......绝对认为这是 GMAIL 的事情。
有人知道如何解决这个问题吗?
Hello and thank you for any help in advance.
I'm using swiftmailer, SMTP transport method to send email from my PHP script.
Sending the message is fine. It works.
The problem is, no matter what I set the FROM,REPLYTO,SENDER settings to, The email comes through as the GMAIL mailbox (ME - [email protected]) instead.
$transport = Swift_SmtpTransport::newInstance('imap.gmail.com', 465,'ssl')
->setUsername($login)
->setPassword($password)
;
$message = Swift_Message::newInstance($subject)
->setFrom(array('[email protected]' => 'test mcttest'))
->setReplyTo(array('[email protected]' => 'test mcttest'))
->setSender('[email protected]')
->setTo(array($to))
->setBody(wordwrap($body, 70))
->setContentType('text/plain')
;
So the email goes through fine, but instead of being from [email protected] as the sender... it's [email protected]
I switch to a separate (non-gmail) SMTP server to test and the email went through fine, without any problems... definitely think it's a GMAIL thing.
Anyone know how to get around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,Gmail 会将发件人电子邮件地址更改为与您正在验证的帐户相同的地址。除了成为 Google Apps 的付费客户之外,没有其他解决方法。
Yes, it is Gmail that changes the sender e-mail address to be the same of the account you are authenticating. There is no workaround for that, except maybe becoming a paid customer of Google Apps.
有趣的是我也遇到过同样的问题。但作为一点洞察,我认为这实际上是 Swiftmailer 的问题。
还有其他库和框架(Codeignitor 在我的脑海中弹出)可以让您使用 Googlemails SMTP 服务器,同时将发件人地址屏蔽为您选择的电子邮件地址。
Funnily enough I've come across the same issue. But as a bit of an insight, I think this is actually a Swiftmailer issue.
There are other libraries and frameworks (Codeignitor pops in my head) that will let you use Googlemails SMTP servers while masking the from address as an email address of your choosing.