Fri Dec 3 12:27:56 EET 2010

How to fix "Could not instantiate mail function", PHPMAILER_RECIPIENTS_FAILED and PHPMAILER_FROM_FAILED on Joomla and RSforms

've used the RSForms to build some custom Joomla Contact forms.
The RSForms was recommended to me by a friend and actually it's a pretty cool and quick way to create forms.
I've installed it and played a bit with it to create a custom forms for one of the website I had to bring up just recently.

After the contact form was ready however there was a problem with sending emails. It took me quite a while to find out how to solve the problemwith contact not able to mail whatever is filled in.

First time I tried the RSForms after filling in the details and pressing the submit button,I got the error message;

Could not instantiate mail function.


I should say that, I'm running a QMAIL email server on the server where I have the Joomla & RSForms installed and configured.

I've came up with a solution to this issue after some research in Google

In order to solve that you will have to login to your Joomla administrator and
Navigate to:

Site -> Global Configuration -> Server


Whenever it opens up you should be seing the Mail Settings on the bottom right corner;

From there you will have to change the Mailer from PHP Mail Function to SMTP Server

To give you a better idea check out the screenshot of the Mail Settings below:

Mail Settings dialog Joomla, Solve Could not instantiate mail function

Changing this simple setting resolved the Could not instantiate mail function for me.

Right after I tested the RSForms to send my filled in form content but this time the PHPMAILER_RECIPIENTS_FAILED message was there;

This error was caused actually by a mistake I made in the configuration of the Custom RSForm I have prepared;

In Components -> RSForm!Pro -> Manage forms whenever I was preparing my form I've made a mistake in the User Emails customized field in my custom prepared form in the To: field I had a wrong variable set (a different value was set from the E-mail caption I've set on).

Solving this solved the issue. Even though the PHPMAILER_RECIPIENTS_FAILED was gone now, next I was unpleasently surprised by another error message which prevented the Contact form to properly send the input data:

Now I had to fight with the error;

PHPMAILER_FROM_FAILED


It took me a while and a lot of forums reading before I figure it out again my custom prepared RSForm had an issue;

The problem was in the Admin Emails customization of the form in the From: fill in box I had mistakenly typed in proper email, setting a proper email there solved the issue;

I've red online many suggested solutions to the issue which dealt with changes in the the file  joomla/components/com_contact/controller.php around line 112, 162 etc.

I should say that before I found and solved the actual problem I've tried modifing this file also but with zero success.

Sometimes Linux is so complicated, it really pisses me of, why is not life easier? :|