[英]Authenticating an email sender with a domain
I have a simple PHP form that sends an email to its visitors from name@domain.com. 我有一个简单的PHP表单,可以通过name@domain.com向访问者发送电子邮件。 My form lives on example.com. 我的表单存在于example.com上。 Because the from email's domain doesn't match up with where it came from, it might look like spam. 由于来自电子邮件的域与其来源不匹配,因此它可能看起来像垃圾邮件。 Is there a way to verify the domain? 有没有办法验证域名?
Campaign Monitor has something built for this but I was wondering if there was a framework or a way to use the same logic outside of Campaign Monitor. Campaign Monitor有为此构建的东西,但我想知道是否有一个框架或方法在Campaign Monitor之外使用相同的逻辑。 http://help.campaignmonitor.com/topic.aspx?t=88 http://help.campaignmonitor.com/topic.aspx?t=88
You have to setup SPF records, and authorize the outgoing mail server of example.com to send mails in the name of domain.com. 您必须设置SPF记录,并授权example.com的外发邮件服务器以domain.com的名义发送邮件。
In practice you have to add something like the following TXT (and if possible the newer SPF) DNS records: 在实践中,您必须添加类似以下TXT(如果可能的话,更新的SPF)DNS记录:
domain.com. TXT "v=spf1 redirect=example.com"
example.com. TXT "v=spf1 a:mail.example.com"
See SPF Record Syntax for more information. 有关更多信息,请参阅SPF记录语法 。
Also note that "from" address is not checked at all by SPF, you can use whatever domain you want. 另请注意,SPF根本不会检查“发件人”地址,您可以使用您想要的任何域名。 It is the reverse-path in the SMTP envelope which counts, although usually they are the same for personal mailings. 它是SMTP信封中的反向路径,但通常它们对于个人邮件来说是相同的。 You can check these in any mail you receive: open the source of the mail, and look for the Return-Path and of course the From header. 您可以在收到的任何邮件中查看这些内容:打开邮件来源,然后查找Return-Path,当然还有From头。
You can also add the IP address of domain.com into the SPF Record as well.. 您也可以将domain.com的IP地址添加到SPF记录中。
Something like this.. 像这样的东西......
example.com. TXT "v=spf1 a mx ip4:x.x.x.x ~all"
Replace the xxxx with the IP address of domain.com, with the spf record you can incorporate all the suggestions from other members into it as well 将xxxx替换为domain.com的IP地址,使用spf记录,您可以将其他成员的所有建议合并到其中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.