How to configure a form for successful email delivery

Although you’d think email forms would come preconfigured to work successfully in all environments, you’d be surprised how often they’re poorly configured by default. There’s a number of very particular aspects to the configuration of contact forms that need to be set precisely in order to work successfully both with our hosting and more generally in the modern world of email. Here’s an overview. For each item in the list we’ll go into more detail below.

  • From, To, and Reply-To headers must be set correctly
  • If mail is not hosted with us, it’s best to use SMTP to deliver mail and configure the SMTP settings to use your 3rd party mail provider’s SMTP server. If this isn’t possible, fall back to ensuring your SPF record is set correctly to allow our server to send emails on behalf of your domain. You will also need to ensure the mail service is disabled for the domain.
  • Disabling HTML formatting can improve deliverability

In the settings and examples below we’re going to be using the name Random Visitor and email address as our sample data to represent the visitor to your website that is submitting the form. We’ll also be using the to address of, which is where contact form submissions will be sent.

From, To, and Reply-To Headers

The first setting that is often misconfigured is the “From” header.  Most people will configure their website’s contact form to have the messages coming from the email address that the submitter entered in the form, such as However this is bad practice, and will usually cause messages to not be delivered!

The reason why this can cause delivery issues is because it often clashes with SPF records. You can read a whole bunch about how SPF records work here, but the general idea is that SPF prevents email forgery by comparing the email address of the sender against the server the email is coming from. If the server is approved, then it’s probably a message coming from the sender and not spam pretending to be from them.

Why then, you might ask, does SPF checking have a problem with using as the From address?

When your email server receives the message send via the contact form, it checks for its SPF record, which specifies servers that are allowed to send emails on behalf of email addresses. Since the server your website is hosted on is not an approved sender for addresses, it will fail the test and thusly the message is either dropped or filtered to spam.

The solution is actually quite simple! Set the “From” address to an email address that is hosted on your server. For example we often use (Be sure to replace with your actual website’s domain, no www).

Then to ensure that when you reply to these emails, the replies actually go to the person who submit the form, you need to set the Reply-To header to the submitter’s email address. With some contact form plugins, you can simply enter this in a Reply-To field, but with others you need to add it to an “Additional headers” field. Here’s a couple examples:

  • Contact Form 7 has an ‘Additional Headers’ field. Enter: Reply-To: [your-name] <[your-email]>
  • Gravity Forms has a Reply-To Field. Enter: {Name (First):1.3}{Name (Last):1.6} <{Email:2}>

Note that [your-name] and [your-email] are default tags that Contact Form 7 uses as a placeholder; if you’ve changed the name of the tag, be sure to put in the correct placeholder there. The same is true for {Name (First):1.3} and {Email:2} when using Gravity Forms — be sure to use the correct placeholder values for your particular form.

Address Formatting (From/To)

Make sure that your form is configured so that all email addresses are formatted correctly, including the from address, to address, and the reply-to field. If your form system has a field for name and email, then it *should* be formatting this correctly for you. If it only provides an email field, you may need to format this yourself:

Name <email_address>
e.g.: John Smith <>

Non-Local Email

If your email is not hosted with us and instead you have it managed elsewhere (E.g.: Gmail, Hotmail, BellAliant, Eastlink), for best delivery you’ll need to either:

a) configure your contact form to use your email provider’s SMTP service (often not available on shared hosting), or
b) configure your SPF record to allow your web hosting server to send email on behalf of your domain and disable local mail handling

If you haven’t already done this, when using external mail, you must disable the local mail service.

a) Use 3rd party SMTP

If you’re hosted on your own VPS hosted in Canada with Websavers, you can configure SMTP using any port. If you’re on shared hosting, you can only configure SMTP over port 587, so your mail provider must support this (most do).

You’ll need to check with your 3rd party mail service provider for the correct settings to use for SMTP. This will consist of a server hostname, port, username, and password (though as a reminder we only support port 587 outgoing on shared servers). Once you have these settings, you then need to enter them into your web application’s configuration.

While we can’t provide precise directions here for the correct settings to use for all external mail services, as there’s quite a few of them, we can show you how to get to the point of entering those settings for specific web applications:

  • WordPress: The WordPress SMTP plugin will allow you to enter the SMTP details for your mail provider so that all messages sent via WordPress will now go through their servers rather than being sent locally from the server where your website is hosted. It also comes with pre-configured values for Gmail and other common providers.
  • Magento: The SMTP Pro Email plugin has worked very well for us. Install the plugin using their guide, then configure it to use common email providers like Gmail or custom SMTP credentials for all emails leaving Magento.

If you’re using another application and have found a solution for using 3rd party SMTP providers, please let us know in the comments below!

b) Adjust your SPF Record

You also have the option of allowing your web server to send mail on behalf of your domain. It’s important to note that if your DNS is hosted with us, in most cases we have already configured this for you.

To get started, log in to the control panel of the company where you have your DNS hosted and find the record of type TXT or SPF that begins with: v=spf1

Edit the record by adding one of the following immediately after the v=spf1

For a shared server (standard hosting):

For a Canadian virtual server (VPS): a or ipv4:{server_ip}

Make sure there is one space character before and after this new addition, then save your DNS settings. The change could take up to 24 hours to complete, so please be patient!

As indicated above, you must also disable local mail handling to ensure that your messages aren’t being delivered locally from WordPress to the mail service hosted on the same server.

Disable HTML Messages

Most form plugins (like Gravity Forms) sadly do not support the multi-part standards required for normal email communications with an HTML message body. Spam filters will detect that the message format being used does not match the standard because it only uses HTML with no plaintext version, making it ‘malformed’. Malformed messages are most commonly attributed to poorly coded spamming software and therefore the messages end up getting spam points against them.

If you must use Gravity Forms, or any other form plugin that also does not support multi-part standards and you wish to be sure messages sent via the form make it to the destination, your best bet is to disable HTML messages such that it only sends plain text. Here’s how to do that with different form plugins for WordPress:

Using the correct configuration for your forms, as described above, will ensure accurate and successful sending of all messages through the forms on your website.

About Jordan Schelew

Jordan has been working with computers, security, and network systems since the 90s and is a managing partner at Websavers Inc. As a founder of the company, he's been in the web tech space for over 15 years.

Leave a Comment