Forums

Could not instantiate mail function

chronorob 27 Jan, 2012
In a previous installation (Joomla 1.7) ChronoForms works fine set to email the form data. In a new install on another Joomla 1.7 site I am getting a "Could not instantiate mail function" error. What is odd is that in testing the form I did receive the email on two trials then I made a change to the form (removed an element) and the message started to appear. I tried creating an entirely new form but the message continues.

One other nuance is that when setting the action Events each action has a parenthetical phrase after it which does not appear on my other installation. Screen shot attached.

Any ideas what I may have set up incorrectly?
GreyHead 29 Jan, 2012
Hi chronorob,

The numbers in parentheses are action idexes that Max added in the latest release. There is now a code snippet that will let you disable an action using the index.

The "Could not instantiate mail function" message is one of Joomla!'s all-purpose mail error messages. If the Email was working and has stopped you may have changed an input name that was being used in the Email setup.

Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here. Note: if you are using the Easy Wizard you may need to switch to the Advanced Wizard to do this; if you want to continue to use the Easy Wizard please make a copy of your form first and add the Debugger action to the copy.

Bob
madcabbage 05 Feb, 2012
I've had the same problem, and it's because I was using a fake email address in my 'Email address' when sending test emails, then using that email address in the Dynamic From field. Switching it a static From Email fixed this.

I know the PHPMail in Joomla isn't down to chronoforms, but could it detect if the email address isn't real and throw an error message, instead of the "Could not instantiate mail funtion"?

Alternatively, change the language file parameter for this error to "Please use a valid email address"
GreyHead 05 Feb, 2012
Hi madcabbage ,

Well, you are responsible for the Dynamic data; you can validate an email address with the browser side and/or the server side validation. If you don't do that then you may get errors.

ChronoForms never sees the Joomla! error message and so can't change it. It's in your main Joomla! Language file if you want to change it - but sometimes it may mean just what it says.

Bob
christian.gibson 06 Apr, 2012
I installed Joomla 25 on a test site running on wampserver (apache 2.2.21, php 5.3.10 and Mysql 5.5.20). Openssl is enabled in php.ini. I have tried everything: mailer set to php mail, sendmail and smtp. Currently set to php mail and I still get the dreaded 'Could not instantiate mail function' when trying to submit my Chronoform. In the screenshot attachment you can see the error message with the debug printout. I really am at my wit's end😟
Maybe I can't send mails from a localhost server on my laptop? But when I tried online to send a message using the com_contact component from Joomla it also didn't work http://sebari.nl😒
Can anyone help me?
GreyHead 06 Apr, 2012
Hi christian.gibson ,

You can only send emails from localhost if either (a) you have a mailserver set up on your PC (like Mercury Email that comes with Xampp) or (b) you connect directly to a remote mail service at your webhost or at gmail. Not all web hosts allow remote connection, Gmail generally seems to work OK.

Bob
christian.gibson 07 Apr, 2012
[attachment=1]CannotInstantiateMailFunction2.jpg[/attachment]Hi GreyHead
Thanks for your reply - I would love to buy you a beer, but I'm afraid your alcohol tolerance level would be wildly exceeded - I guess you deal with a million postings per day :?
Actually, I had already tried setting my mail server to gmail, but that still didn't help. Here is a Chronoform test with mail server set to gmail in joomla config.
Does anyone have an idea what might be wrong?
GreyHead 07 Apr, 2012
Hi christian.gibson,

I think the settings need a bit more tweaking. The Mailer has to be SMTP server and I think that the security has to be set too. I Googled and found this diagram which is pretty clear and the Joomla! Docs have an article here.

Bob
christian.gibson 08 Apr, 2012
Hi Bob
Thanks a million for these links πŸ˜€
Following the diagram shown on the first link I finally succceeded in getting an email sent by Chronoform from a localhost website running under WAMPserver on my website (setting mailer to SMTP in Joomla global config and using gmail as the mailserver (smtp.gmail.com).
The only remaining problem is that the message content filled in on the Chronoform is not sent in the message. Instead the email is sent with text from the Chronoform email 'template' tag.... (see in these screenshots).
I guess I am doing something wrong when building my form in Chronoforms, so I shall have to do a bit more research on this.
GreyHead 08 Apr, 2012
Hi christian.gibson,

The screen-shots didn't' make it.

The Email Template tab is where you create the template for your email so I guess that bit still needs to be done. The 'Generate Auto Template' button will create an email template from your Form HTML.

Bob
christian.gibson 08 Apr, 2012
Thanks Bob, I think I found an answer. I gave text area element in my form the field name 'message'. In the action details for email on submit I clicked on the 'template' tag. In the template I then removed the standard text and replaced it with the field name 'message' between curly brackets. It looks like this:
This topic is locked and no more replies can be posted.