I am attempting to send emails from my website (localhost, test and live) and I am finding that only a fraction ever reach their destination. One of the problems may be that my web server is not communicating the fact that my emails are coming from a valid email address and/or source.

I've read that my web server (or DNS) may be contacted by an email system regarding the emails that that appear to be sent from my domain. If the server does not respond and tell the email system that the email address or IP address is trustworthy, the email may be treated as spam.

How does this validation system work? How do I add emails and IP addresses to my server so that they are regarded as good sources?

In general, I want for emails to be seen as valid when they come from my server and when they come from my localhost (for testing reasons.)

  • I used to send all web based e-mail through my SMTP server. If there is a new way, I am not aware of it.
    – closetnoc
    Commented Mar 20, 2014 at 21:31
  • Your sending from the SMTP server on on local machine? That's what I am doing. I'm not really looking for a new way to send email, I just want my ISP or DNS to let the world know that emails coming from my localhost SMTP server are valid emails.
    – Hoytman
    Commented Mar 20, 2014 at 21:42
  • Okay. Do you have a MX record set up in your DNS? Are you able to receive e-mail on your server from the Internet? It may be that the receiving SMTP server cannot always communicate back to your server or check any MX record. It has been a while since I have to deal with these issues. I may have to think on this.
    – closetnoc
    Commented Mar 20, 2014 at 21:50

1 Answer 1


To have emails sent out from a server and to pass certain validation tests you need to configure the server for SPF and DKIM.

SPF is a rather simple process that involves setting an SPF or TXT record in your DNS records. The receiving mail server, then checks the DNS record to see if the sending machine is authorized by your domain's records, just as you are describing in your question. A simplified explanation of SPF is that there is a record containing the IP addresses of the machines that are authentic mailers for the domain in question.

DKIM is a little more involved and may require you to configure a mail client on the sending machine.

From this page: http://www.elandsys.com/resources/mail/dkim/opendkim.html. Here's basically what DKIM does: A domain owner generates a private/public key-pair that will be used to sign messages originating from that domain. The public-key is placed in DNS as a TXT record. The private-key is kept on the mail server which sends email for the domain. When an email is submitted by an authorized user of that domain, dkim-milter uses the private-key to digitally sign the email associated with the sending domain. The DKIM-Signature header and signature is added to the email and the message is sent. When a message is received with a DKIM-Signature header, opendkim extracts the signature and the sender's domain from the email. It does a DNS lookup on the TXT record to fetch the public-key for the sender's domain. Using the public-key, opendkim verifies whether the signature of the email is valid. An Authentication-Results: dkim=pass header is inserted as a mail header if the verification is successful.

I hope that points you in the right direction.

  • Thanks, I am researching SPF records, but finding a helpful example is difficult. Could you provide and example or link to an example that will help me to validate emails from both my live server and my localhost (which operates from a range of IP addresses?) Note: I'm not just sure what -all does.
    – Hoytman
    Commented Mar 21, 2014 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.