Contact Form Problems With Gmail and Hotmail

OK, this isn’t really a problem, it is just that I was being stupid and didn’t realise what I had coded was stupid. In the hope that I can save someone from the same fate I am documenting it here.

I Coded A Contact Form

I wrote a very simple web site – a temporary holding site as it happens, for a friend, who is just starting out with a new consultancy business.  The idea was that she would at least have a web presence of sorts, until she could learn how to run a WordPress site for herself. So all it is, is a home page, contact page and a services page.

I put the contact form together, and wrote the code to send the resulting enquiry to her Gmail address. This was a BIG mistake.

My friend (her name is Davina by the way), has a Gmail account, and she also has an account on her domain name. I could have specified that the contact form sent the email to her domain name email address, but no. Thanks to my blind love affair with Gmail , I sepcified that the contact form should send to her Gmail . In the email send code I put :

  1. to : Davina’s Gmail address
  2. from : visitor’s email address

Don’t Use Gmail In Contact Forms

In fact don’t use any web based service in contact forms as the send-to address. Why? Well, the email won’t get delivered if the visitor to your site, using the contact form ALSO has a Gmail or Hotmail address. This was not obvious to me. So I’ll explain in case it is not obvious to you either.

When you code your own contact form, you generally put the visitor’s email address in as the “from” address. It really isn’t the “from” address – you are just saying it is.  The email really is just coming from your server, pretending to be from the visitor’s email address. The reason you do this is so that the the enquiry can be answered just by hitting the “reply” button when you answer a query from your web site.

But when the visitor’s email address is also a Gmail address, Gmail knows that the IP address of the “from” email is not one of it’s own IP addresses, and refuses to receive it at your Gmail end. It just filters it out and the Gmail never arrives.

Use Your Domain Email Address

I fixed this problem by sending to Davina’s domain address, which I had auto-forwarded to gmail. Now all her enquiries get through and she is still able to use her Gmail account to monitor all her incoming email.

Davina’s Site is here.