使用gmail smtp服务器时如何更改地址 [英] How to change from-address when using gmail smtp server

查看:265
本文介绍了使用gmail smtp服务器时如何更改地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过gmail将 A 的电子邮件发送到 B ,使用 HEADER CONTENT / p>

PHP如何做?



我已经指定了 FROM from@example.com),但收到电子邮件时,仍然来自我的Gmail帐户(abc@gmail.com)。



screenshot from address http://maishudi.com/mail.jpg

  $ mail-> From =from@example.com; 
$ mail-> FromName =Mailer;
$ mail-> AddAddress(abc12@163.com,Josh Adams); // name是可选的
$ mail-> AddReplyTo(abc12@qq.com,信息);

如何更改 FROM 部分?

解决方案

简短的答案 - 你不能。



Google重写From和Reply-通过邮件发送的邮件中的邮件头与您的Gmail帐户相关的值。



gmail的SMTP功能不是打开或中继服务。如果它允许任何值为From头,它将显着淡化Google的垃圾邮件服务的地位,因为没有办法验证发件人的凭据。



你需要考虑替代品。您计划在完成脚本/应用程序/网站时主持:几乎每个托管解决方案(共享/ vps /专用服务器)都将预先配置电子邮件传输解决方案:无论是在* nix或IIS上的sendmail或postfix在Windows上。



如果您打算使用gmail,则可以:




  • 设置一个专门的myapp@gmail.com帐户

  • 如果您拥有您所要发送的域名,请使用免费gmail域,并设置myapp@mydomain.com帐户。



====



编辑2015年6月



有人建议,GMail允许通过不同的地址发送。据我所知,这是通过GMail wep应用程序发送的,并利用您现有的外部SMTP服务器,这与原始问题无关。



= ===



编辑2013年11月



看到这仍然是一个滴滴的选票。快速更新。



Google已经撤销了免费的Gmail域名。周围还有很多其他的免费服务。注意事项之一是 Mandrill - 一种用于交易电子邮件的一对一电子邮件服务(例如电子商务订单等)。这是由MailChimp运行的,他几乎非常了解所有关于发送电子邮件的知识。他们也给你12K /月免费,这是相当不错的。


I want to send an email from A to B,with HEADER and CONTENT through gmail.

How to do that by PHP?

I've specified the FROM(from@example.com),but when I receive the email,it's still from my gmail account(abc@gmail.com).

screenshot of from address http://maishudi.com/mail.jpg

$mail->From = "from@example.com";
$mail->FromName = "Mailer";
$mail->AddAddress("abc12@163.com", "Josh Adams");// name is optional
$mail->AddReplyTo("abc12@qq.com", "Information");

How do I change the FROM part?

解决方案

The short answer - you can't.

Google rewrites the From and Reply-To headers in messages you send via it's SMTP service to values which relate to your gmail account.

The SMTP feature of gmail isn't intended to be an open or relay service. If it allowed any values for the From header, it would significantly dilute Google's standing with spam services, as there would be no way to verify the credentials of the sender.

You need to consider alternatives. How are you planning to host your script/application/website when it's finished: virtually every hosting solutions (shared/vps/dedicated server) will come pre-configured with an email transfer solution: be it sendmail or postfix on *nix, or IIS on Windows.

If you are intent on using gmail then you could:

  • Setup a dedicated "myapp@gmail.com" account
  • If you own the domain you are supposedly sending from, use the free gmail for domains, and setup a "myapp@mydomain.com" account.

====

Edit June 2015

It was suggested that GMail does allow sending via different addresses. As far as I can tell, this is for sending via the GMail wep app, and utilises your existing external SMTP server, which is not relevant to the original question.

====

Edit Nov 2013

Seeing as this is still getting a trickle of votes. A quick update.

Google have withdrawn their free GMail for domains. There are plenty of other free services around. One of note is Mandrill - a one-to-one email service intended for transactional emails (e.g. ecommerce orders etc.). It's ran by MailChimp, who pretty much know all there is to know about sending email at volume. They also give you 12k/month free, which is rather nice.

这篇关于使用gmail smtp服务器时如何更改地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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