Question

I have a simple PHP form that sends an email to its visitors from name@domain.com. My form lives on 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. http://help.campaignmonitor.com/topic.aspx?t=88

Was it helpful?

Solution

You have to setup SPF records, and authorize the outgoing mail server of example.com to send mails in the name of domain.com.

In practice you have to add something like the following TXT (and if possible the newer SPF) DNS records:

domain.com.  TXT  "v=spf1 redirect=example.com"
example.com.  TXT "v=spf1 a:mail.example.com"

See SPF Record Syntax for more information.

Also note that "from" address is not checked at all by SPF, you can use whatever domain you want. It is the reverse-path in the SMTP envelope which counts, although usually they are the same for personal mailings. 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.

OTHER TIPS

You can also add the IP address of domain.com into the SPF Record as well..

Something like this..

example.com.  TXT "v=spf1 a mx ip4:x.x.x.x ~all"

Replace the x.x.x.x with the IP address of domain.com, with the spf record you can incorporate all the suggestions from other members into it as well

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top