The Enhanced WP Contact Form plugin for Wordpress is one of a few handy contact forms that are easily to added to your wordpress site. However, if you try to use it on a wordpress site hosted on a windows server you may get an error massage similar to the following when you hit the 'submit' button on the contact form:
Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in \wp-content\plugins\enhanced-wordpress-contactform\wp-contactform.php on line 178
It turns out that the windows mail transport does not like the friendly from email address that the plugin specifies, e.g.
From: webmaster <webmaster@pridedesign.ie>
it doesn't like the bit in the angled brackets <>, nore does it like the spaces.
So, one way to fix the problem is to quickly edit the plugin and remove the offending part from the 'From:' header. To do this:
1.) Go to your wordprss admin screen
2.) Click on the 'Plugins' tab
3.) Find the plugin called 'Enhanced WP-ContactForm', and click 'Edit'
4.) In the displayed code, find the line similar to:
$headers .= "From: $name <$email>\n";
5.) Edit this line and remove the <$email> bit so that you just have something like:
6.) Now that we have removed the email address from the 'From:' field we need to add it somewhere else in the message, so find the line similar to:
$shortmsg = "$name ($website) wrote:\n";
7.) Edit this line and add the from email address (stored in the variable $email), somthing like:
$shortmsg = "$name ($email, $website) wrote:\n";
8.) Hit the update button and test your contact form, and if the wind's behind you, then you should now no longer get the above error message and everything should work perfectly!
Note: to use this contact form in wordpress in Windows (or any other email based functionality) you will need to install one of the few plugins that lets wordpress send emails via SMTP, something like the Swift SMTP plugin.
I never tried it on windows hosting before but I was going to so now I know what to expect. Thanks for keeping us posted on this WordPress ContractForm issues.
Did you find this post helpful? If so, we'd love to hear from you in our comments! If you found it really useful we'd love a link from your Blog-Web Site, to us!
That's very helpful, thanks very much!