Amazon The following is information shown by going to Site -> System Information.
PHP Built On | Linux ip-10-1-2-3 4.5.6-7-ec2 #18-Ubuntu SMP Mon Oct 18 21:00:20 UTC 2010 i686 |
Database Version | 5.1.61-0ubuntu0.10.04.1 |
Database Collation | utf8_general_ci |
PHP Version | 5.3.2-1ubuntu4.14 |
Web Server | Apache/2.2.14 (Ubuntu) |
WebServer to PHP Interface | apache2handler |
Joomla! Version | Joomla! 2.5.4 Stable [ Ember ] 2-April-2012 14:00 GMT |
Joomla! Platform Version | Joomla Platform 11.4.0 Stable [ Brian Kernighan ] 03-Jan-2012 00:00 GMT |
User Agent | Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19 |
As you can see I use Joomla 2.5.4, but this tutorial applies to every previous version of Joomla. If not let me know!
The Problem
I am using Joomla's built-in contact form mechanism. The back-end administrator can create contacts and link them to a menu item so that when the menu item is selected information of each contact and a contact form are displayed. The front-end works great and looks something like this:
The issue is when someone that visits my site fills out the form and clicks on 'Send Email' to submit the form the destination contact does NOT receive an email even though they are supposed to! Why is that? Did I do something wrong?? Is it a bug of Joomla's???
Prerequisite
First and foremost, make sure your server has been set up to send out emails. Refer to my other tutorial - How to Send Emails with PHP - if you need help.
The Solution
This turns out to be a stupid setting that you need to set correctly in order for Joomla to send emails when the contact form has been submitted.
In the contact settings or menu item's settings for the contact you MUST select NO in the 'Custom Reply' field in the 'Mail Options' tab! Here's a screenshot. The red circle indicates the correct setting.
Remember: Contact settings override Menu Item's settings!
This is all due to the code logic in components/com_contact/controllers/contact.php:
... if (!$params->get('custom_reply')) { //line 101 $sent = $this->_sendEmail($data, $contact); } ...If you want to change 'from' Email field look into your configuration.php's:
public $fromname = 'http://www.example.com/';Change the value of $fromname and you are done.
Any questions? Let me know!