How to configure a form for successful email delivery

Although you’d think email forms would come pre-configured 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. The first two we’re going to discuss will help you with general email deliverability as well as your forms, while the last two apply specifically to form configurations.

  • Use SMTP? If you’re using external mail services, be sure to use SMTP to send your emails.
  • DNS Records: ensure you have an SPF and DMARC DNS record. If you’re using SMTP to deliver mail, also configure DKIM with your SMTP provider.
  • Email Headers: From, To, and Reply-To headers must be set correctly
  • HTML Messages: 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.

Non-Local Email: Use SMTP

If your email is not hosted with us and instead you have it managed elsewhere (E.g.: Gmail, Hotmail, BellAliant, Eastlink), for best delivery we recommend configuring your form to use SMTP and directly route mail through your mail provider’s service, rather than allowing our server to send it directly. This ensures that all headers for optimal deliverability are applied to the message because it flows through the correct mail service.

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

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. 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!

SMTP Port Tips: 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, our firewalls will only allow SMTP over port 587, so your mail provider must support port 587 (most do).

Mail Deliverability DNS Records: SPF, DKIM, DMARC

Read over our article on managing your mail validation records to learn how to configure SPF, DKIM, and DMARC DNS records. You’ll find a record generator on that page to help you select the best options.

This is absolutely essential to keep your messages out of spam / junk folders of the big providers.

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 <>

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