CakePHP 使用 GMAIL 发送电子邮件
我有以下代码:
$this->Email->smtpOptions = Configure::read("Email.smtpOptions");
$this->Email->delivery = 'smtp';
$this->Email->sendAs = "html";
$this->Email->from = $_POST['name'] . ' <' . $_POST['email'] . '>';
$this->Email->replyTo = $_POST['name'] . ' <' . $_POST['email'] . '>';
$this->Email->to = CONTACTEMAIL;
$this->Email->subject = WEBSITEURL . " - Contact Form";
$this->Email->template = "contactform";
唯一的小问题是,当查看实际发送电子邮件的人时,电子邮件地址是我用来连接 GMAIL SMTP 的地址,名称实际上没问题。感谢replyTo属性,当点击回复时,“收件人”地址很好,但我真的很想知道是否可以有我设置的“发件人”地址。
I have the following code:
$this->Email->smtpOptions = Configure::read("Email.smtpOptions");
$this->Email->delivery = 'smtp';
$this->Email->sendAs = "html";
$this->Email->from = $_POST['name'] . ' <' . $_POST['email'] . '>';
$this->Email->replyTo = $_POST['name'] . ' <' . $_POST['email'] . '>';
$this->Email->to = CONTACTEMAIL;
$this->Email->subject = WEBSITEURL . " - Contact Form";
$this->Email->template = "contactform";
The only tiny problem with this is that when viewing who actually sent the e-mail, the e-mail address is the one I am using to connect with the GMAIL SMTP, the name is actually fine. Thanks to the replyTo attribute, when clicking reply, the To address is fine but I really would like to know if it's even possible to have the From address as I set it.?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将发件人地址添加到 Gmail 并进行验证:
http://www.askdavetaylor.com/configure_google_gmail_to_have_a_ Different_sender。 html 有一个关于如何执行此操作的很好的指南。
You need to add the sender address to gmail and verify it:
http://www.askdavetaylor.com/configure_google_gmail_to_have_a_different_sender.html has a nice guide on how to do so.