Having a web presence is essential for all businesses, and if the website contains a contact form then it is essential that it correctly sends contacts to that business. Contact forms are useful as it allows users to easily contact you directly through your website.
I have recently had a very frustrating time trying to get into contact with a number of different companies due to their contact forms not working correctly. I think the overall success rate was about 40%, which is a terrible response rate.
One company I (eventually) got in contact with were very thankful that I pointed out that their contact form didn't work since they wouldn't have known otherwise. They only realised after the fact that they hadn't been getting any emails.
This experience got me thinking about how to give the best possible experience for a user when they fill in the contact form on a website.
Obviously, a contact form should send an email to the business from the website, which is essentially the primary function of the contact form. But what else can you do to improve the experience for users?
In this article I will look at how you can ensure that those precious contact messages get saved and are received.
Ensure Your DNS Is Correct
One of the main causes of emails not reaching their intended destination is through an improperly configured DNS (Domain Name System) record. DNS is essentially used to inform the internet where your website is hosted and consists of different types of records.
Aside from the DNS records that show where the site is hosted there are also a number of records associated with email. The MX (Mail Exchange) record is used to point to the server that handles the domains emails, and this needs to be correctly set up in order for email to be received. MX records are easy to test since no email will be sent or received without it and is usually not the cause of contact form problems.
Commonly overlooked, however, is the SPF record. The SPF (Sender Policy Framework) record is a mechanism that is used to check that the server sending the email has the correct permissions to do so. This applies to contact forms since the emails they send can come from a different server (i.e. the web server) than the primary email domain (as denoted by the MX record).
As an example, let's say that your MX record is configured to use mx.example.com, but your website is hosted on www.example.com. You therefore need to setup an SPF record so that emails can be sent from either mx.example.com or www.example.com.
What this means is that if the SPF record isn't correctly configured then any emails you send from your website will be rejected by email routing servers and will never reach their destination. As the email makes its way through the internet it the meta data associated with the email will be inspected by email routing servers, who will reject any email that isn't set up correctly.
I won't go into great detail about SPF records here, but I will look into some basic information.
SPF records are actually stored as TXT records in your DNS, which means that if we want to find them we need to interrogate the DNS records of the domain. There are a couple of ways to check SPF records, your can use the nslookup tool to search for TXT records.
nslookup -type=txt example.com
You can also use dig to search for the TXT records.
dig txt example.com
The SPF record will look something like this:
This shows us that we are using SPF version 1 (as denoted by the text "v=spf1") and to be very strict on the rule by setting "-all", which will either allow or reject the email based on the information in the record.
Applying the previous example with mx.example.com used for email and www.example.com used for the website we would create an SPF record that looks like this.
v=spf1 include:mx.example.com include:www.example.com ~all
This means that emails can come from either the mx.example.com address or the www.example.com address. The inclusion of "~all" at the end means that the emails are accepted or marked as suspicious.
If your website is behind a reverse proxy, load balancer, or other cache layer then you need to configure your SPF record to be from the actual web servers, not the outer cache layers of your website.
In addition, how you send emails from your website depends on how you set up your SPF record. If your contact form sends emails from the web server then an SPF record is essential and should contain both your MX server and your web server information. If your website connects to your SMTP server and sends emails through your email server then the SPF record only needs to contain the MX server.
Essentially, the place that sends the emails and the SPF record attached to your domains DNS record must be in alignment for email to work correctly.
When clients approach me and talk about issues with emails getting through from their contact forms I normally do a quick SPF lookup to see if there are any problems. This is especially the case if the client says that "sometimes emails don't get through" as this is indicative of SPF issues.
Setting up DNS records correctly can often clear up any problems and allow contact messages to be sent freely.
Send An Email Receipt To The User
Sending an email to you business is key, but it's amazing how far sending an email receipt to the user can go in terms of improving customer relations.
If they spend time filling in your contact form then it's only polite that you send them a message received message. This can reassure the user that the contact form on your website actually worked as well and that your business will soon be contacting the user.
You can use this email to set expectations for the user so that they know you will get back to them during office hours and what those office hours might be.
How you do this depends on what mechanism you use to send your emails. For example, if you are using Drupal and the Webform module then you can set this up in a few minutes as this is a standard feature of the Webform module.
Save The Submission To A Database
When a user fills in your contact form then you should ideally be saving their contact form submission to the website database. This allows you to ensure that you have a copy of the submission data saved somewhere safe that you can rely on being present.
You can also use the database to save the personal data that the user has entered into the contact form, which means you don't need to send that information over email. Email isn't a secure medium so transmitting personal information is technically a security issue.
If you do have a database then you also need to be sure that you are following GDPR/data protection rules and regularly clear out the information in the database. Ideally, you should not have unencrypted personal data resting on your site for more than 30 days.
Some contact form systems will allow you to periodically purge the contact database so you don't need to worry about remembering to do it.
How you do this again depends on the website service you are using. The Drupal Webform module I mentioned above can save form submissions by default and can be made to purge those contact details after a set period of time.
Have A CRM System
A CRM system (or Customer Relation Management system) allows you to manage and organise your contacts and pursue them to a sale. It helps you make sure that a contact is recorded and responded to in a timely manner. You can also track statistics of your sales pipelines to see how your business is performing.
A CRM system can be anything from a spreadsheet to a fully managed application like CiviCRM or Salesforce. You can even just use a ticketing system and progress your tickets through swim lanes. It doesn't need to a complex system, it just needs to fit in with your business workflow.
There should be some form of semi-automated transfer of contact information from your website to your CRM system, even if this is just the ability to export and import the data between the two systems.
Larger CRM systems (like Salesforce for example) have APIs that you can submit your contact forms to, which ultimately means that the contact mail isn't required. These systems aren't affordable for some businesses, but it's certainly an option if you are getting lots of incoming messages.
Whatever you use, it is essential that you have something in place so that you ensure you always respond to your contact submissions. It is important to not let anyone fall through the cracks as you'll just be losing money.
Use A Third Party Service To Send Emails
If your website sends a lot of emails, which might be the case on busy commerce sites, then it is a good idea to use a service to send those emails. Systems like this allow you to make sure that emails are correctly sent and also see problems with emails like delivery errors. They have already thought about correctly setting up their DNS records and ensuring that they are able to send out lots of emails every day.
What you are looking for here is a transactional email system, rather than an email marketing system. Transactional emails are tailored to the person who sent the email and are used to send things like order receipts, password resets, or even contact form emails. Instead of sending the email you send an API request to the service, who then construct the email from a template and send it on your behalf.
There are lots of services available, but I have had good success in the past with Mandrill and Sendgrid. They both have a free tier and even their paid plans are very reasonable.
Collect Only The Information You Need
When making a contact form it's sometimes tempting to ask all sorts of questions so that you can organise your business. Whilst this allows you to properly direct the contact request to the correct department you need to be careful what information you ask for.
The minimum amount of information you need is an email address, or perhaps a telephone number. You can also include a name to help you personalise the response from your business, but you need to think very carefully about adding extra fields beyond this core information.
If you have a complex, multi-page contact form with lots of different options that people are just not going to fill it in. They will look at the form and just go elsewhere to find a business with a less complex form. The golden rule is "kiss" or "Keep It Simple, Stupid". I have seen (and built!) contact forms in the past that have been obviously designed by committee and ask all kinds of questions that really aren't important to the end user. For example, the "where did you find out about us?" question is important to the marketing department, but end users really don't care when they are trying to contact a company.
Essentially, don't put up barriers between your business and your potential customers just so you can ask questions that aren't important to them.
Use Spam Protection
Sadly, if you have a contact form on your website then there is a 100% chance that it will be used to send you spam. This is frustrating as it can often drown out legitimate enquiries meaning that you won't notice new business because of all the other messages.
There are a few techniques that you can employ to prevent spam messages from being submitted. I would suggest employing as much as you can without putting up barriers that make it difficult for users contact you.
Start with something small like a honey pot form field. This is a form field that shouldn't be filled in by legitimate users (because it is hidden) and is a quick way to spot bots since they will add content to all fields they can find. You can then build upon this, but I have found that adding a variety of different techniques are often best to prevent spam.
I have worked with Drupal sites in the past to reduce their spam levels and this has mostly been successful, although it is quite difficult to reduce the level to absolute zero. I have also found that the bigger the site the more determined people are to submit spam messages. This means that automated protection isn't enough and some messages will often get through anyway.
Ultimately, a contact form is a good thing to have on your website, but you absolutely need to get it right for it to produce value to your business. A non-functioning contact form is essentially a rubbish bin for your customers messages, and if just going to cost you money.
You can have other means of communication on your site as well. A phone number and an email address are good backups to have, but if you have call to actions to your contact form then it should work correctly.
I have dealt with a few websites that have had problems with their contact forms. Most problems have been solved with a simple configuration change (eg. SPF records) but some have required more work to ensure emails get send out correctly. In one case the site code was actually broken and required a fix before email would send out corectly.
I have occasionally come across more critical issues like mail blacklisting, which can be more difficult to spot and take more effort to solve.
Adding a mail queue is also a good idea as it means you can re-try emails if they aren't sent out correctly (for whatever reason).
If your site sends lots of emails (outside of contact forms) then it's best to not rely on the web servers ability to send emails. You should instead be using an SMTP service or even a transactional email system like Mandrill.