Fixing a Broken Contact Form on a Joomla Site
If you are having the same problem as I have had with the Joomla contact form not delivering the mail to your email address maybe this solution can help. This problem only occurs under certain circumstances. You Joomla site is hosted on one webserver, your mail is on another and your DNS records on another. This circumstance is more common than you would expect, say you register your domain with 123-reg and enter your MX records here, your site is hosted elsewhere and you are using Google Apps (gmail for domains) for your email.
To trouble shoot the issue first make sure your server is actually able to send mail. Set your email address to another address you have access to e.g. hotmail, yahoo, gmail in Joomla. If the form contents is received by this address we know it is not a problem with the servers ability to send mail but the address itself.
You can test PHP mail is working on your server by creating a simple PHP file, call it “testmail.php” and put in the following code substituting your own email address.
mail("firstname.lastname@example.org", "Testing PHP mail", "Email sent successfully");
echo "Mail Sent.";
Upload the new file and open it in your browser. If all is well it will send a mail and tell you it worked.
The problem is therefore either the mail server not accepting messages from the web server, or the web server not sending to the mail server.
If you have access to cPannel WHM, you can run the “Mail Troubleshooter” (under the “Email” section in WHM). Enter your email address and the system will test the address and display MX lookups for that address.
virtual_aliases via virtual_aliases router forced address failure
If you don’t get the MX lookups but the above message, don't worry as we have a solution.
The red line shows what happens when the server sends a mail to an address on the same domain. The server assumes as the domain is the same it is both the web server and mail server as it has not been told differently. The blue line shows what happens with any other mail address on a different domain. The green line shows how the problem can be fixed.
As the above diagram shows, if your mail is hosted somewhere else, it won’t matter that your separately-hosted DNS server is working correctly you’ll still have to add the MX entries to the web server (otherwise it’ll just look at itself).
The good news is that for those who host their own DNS, WHM/CPanel will pick up the MX entries when you add them to the zone file. For anyone else, MX entries can be added to your control panels “MX Entry” section.
This article was posted on 18 June 2010 in Joomla, PHP
That's the end of this article. I hope you found it useful. If you're enjoyed this article why don't you have a look around the archives, where you can find some more tutorials, tips and general ramblings.