如何代表来自不同域的其他人发送电子邮件

How to send an email on behalf of someone else from a different domain

我正在建立一个电子商务网站(姑且称之为 e-buy.com)。我想要的是一个邮件系统,买家可以在其中向卖家发送电子邮件...例如,我必须发送这样的电子邮件:

from: buyer1@yahoo.com
to: seller1@gmail.com
subject: buyer inquiry via e-buy.com

我已经构建了上述解决方案,但有时我的电子邮件未送达...原因(据我所知)是我从 e-buy.com 域发送电子邮件,但发件人是来自不同的域:buyer1@yahoo.com

问题 1> 将 from 字段设置为不同于邮件服务器域的域是否是一种不好的做法?


我看到一些网站在相同情况下实施了以下解决方案:

from: mailer@e-buy.com
to: seller1@gmail.com
subject: buyer inquiry via e-buy.com e-commerce 

所以电子邮件来自:mailer@e-buy.com,但是当卖家点击回复按钮时,回复自动从 mailer@e-buy.com 变为 buyer1@yahoo.com

问题2>如何实现发件人邮箱的切换?

答案一: 从另一个域发送电子邮件时 - 您需要记住,他们需要设置 DNS 记录以将您的邮件服务器/发件人列为合法的电子邮件发件人,看起来您很可能拥有多个 大品牌 域(gmail、yahoo、hotmail 等),这种方法很可能不是您想要的。

答案2: 这更现实,也很容易实现。您要查找的是 reply-to header。这将指定用户在尝试回复电子邮件时应发送到哪些电子邮件。

进一步解释here

When you send an email to a subscriber and they click 'Reply', the reply message is typically sent to the email address listed in the From: header.

A Reply-To address is identified by inserting the Reply-To header in your email. It is the email address that the reply message is sent when you want the reply to go to an email address that is different than the From: address.

In the example below, 'service@sampledomain.com' is the Reply-To address. When a subscriber clicks 'Reply', the reply message is sent to 'service@sampledomain.com' instead of 'marketing@sampledomain.com'.

From: marketing@sampledomain.com

to: aaasample@zzzexample.com