Remove “via” server name when sending emails from website

SPF records, Return-Path, and DKIM

UPDATE:  This post on SPF records puts my post to shame.  I’ve included some answers below.

If your website sends email to you and it ends up in the spam folder, or in gmail you can see “via”, you’ll need to at least add an SPF record for the domain and set the Return-Path in your emails.

First, make sure the From address is from a domain you own (for example: “”).  You will need access to your DNS records.

Next, you’ll need to set your SPF record on your domain.   The SPF record is a record on your domain that lets mail exchangers know that mail from a specified domain is OK and allowed to send mail.  I’m not an expert at this, so I’ll let Google explain this better here:

For hosting companies you’ll need to find out where the actual emails are sent from.  For WPEngine WordPress installs, use  An excerpt from

The other problem is more subtle: would include mail servers authorized to send mail from the domain This may or may not be the same list of mail servers Network Solutions uses to send mail out using customer domains! Sometimes an ISP will create a special SPF record that customers can include with their record, such as If you want to use an ISP’s mail server(s) you should ask them if they maintain an SPF record for their customers to include, or else you will need to change your record every time your ISP adds, removes, or changes a mail server’s name and/or address.


The Return-Path is another thing you need to set.  The Return-Path of each email should match the email’s From address.  WordPress (and the popular Contact Form 7 plugin) do not do this for you so I made a plugin to set the Return-Path along with other helpful tweaks.

In some cases, you may need to set your DKIM key on your domain.  This further prevents spoofing and helps keep your email out of the spam filter.  DKIM adds a digital signature to outgoing messages.  More on this here:

You can check the spammyness of your email at