Buy Now
Sign in

Mailer Error: Could not instantiate mail function when using PHP Mailer

WhiteLighter01 , October 14 2016
Answered
W
WhiteLighter01
Hi all,

I'm having a weird error on my form.

Mailer Error: Could not instantiate mail function.


My Chronoform settings is set to use PHP Mailer.

Upon submit, the form shows that error above the thank you message. I tried to put the debugger on it and seems like the first email it tries to send fails (email to staff), but the second email goes out without any problem (confirmation email to user). If I drag and switch the two emails around so that it sends out the confirmation email first, still the first email (confirmation email) fails and the second email (email to staff) goes out without any issue. Please see debugger info below (all private/critical info has been replaced)

Array
(
[2] => Array
(
[Email] => Array
(
[0] => An email with the details below could NOT be sent:
[1] => To:staff@domain.org
[2] => Subject:Web Contact: User
[3] => From name:User
[4] => From email:user@domain.com
[5] => CC:
[6] => BCC:
[7] => Reply name:
[8] => Reply email:user@domain.com
[9] => Attachments:
[10] => Array
(
)

[11] => Body:
First name: fname
Last name: lname
Email: user@domain.org
Phone: ##########
Message: This email was sent using CFv5 on WP
IP address: ###.###.###.###
Sent from: http://domain.org/contact-staff/
)

)

[4] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:user@domain.com
[2] => Subject:Domain web contact confirmation
[3] => From name:web contact
[4] => From email:DoNotReply@domain.org
[5] => CC:
[6] => BCC:
[7] => Reply name:web contact
[8] => Reply email:DoNotReply@domain.org
[9] => Attachments:
[10] => Array
(
)

[11] => Body:
Thank you for contacting Staff Name. Your message has been sent with the information you've provided.

First name: fname
Last name: lname
Email: user@domain.org
Phone: ##########
Message: This email was sent using CFv5 on WP
IP address: ###.###.###.###
Sent from: http://domain.org/contact-staff/
)

)

)
calculus00
Hello WhiteLighter01,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
Error: "Could not instantiate mail function"
P.S: I'm just an automated service
I'm an automated service, my answers may help, but they may not be accurate.
W
WhiteLighter01
"calculus00":
Hello WhiteLighter01,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
Error: "Could not instantiate mail function"
P.S: I'm just an automated service


Answering this for those who are reading ^_^

Yes, mail server is properly configured and has been tested to be working. The weird thing is that only the first mail is failing, the second mail is being sent out properly.
GreyHead
Hi WhiteLighter01,

I strongly recommend that you do *not* use the Dynamic From Email element in your Email Setups. Using this often results in your emails being marked as spam and dropped into a spam filter. Instead use the static From Email with an address that matches the site domain name and use Dynamic ReplyTo Email for the user email. The result is the same but with a much better chance of good delivery.

Also you need to have a Dynamic From Name as well as the Email.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
W
WhiteLighter01
Hi Bob,

Thanks for pointing out the Dynamic/Static From. The form that I'm working on has already been using a Static From and a Dynamic Reply To email from the start.
GreyHead
Hi WhiteLighter01,

That's not what I saw in the Debugger data
                    [4] => From email:user @[at] domain [dot] com
[7] => Reply name:
[8] => Reply email:user @[at] domain [dot] com

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
W
WhiteLighter01
Hi Bob,

Sorry, it was a mistake on my part when I replaced the values on the debugger data with generic values. Confirmation emails going to the public users are being sent from our DoNotMail email address and notification emails going to staffs are being sent from web.contacts with a reply to address of the user's email address. The correct values should be as below

...
[0] => An email with the details below could NOT be sent:
[1] => To:staff @[at] domain [dot] org
[2] => Subject:Web Contact: User
[3] => From name:OrgName Web Contact
[4] => From email:web.contact @[at] domain [dot] org
[5] => CC:
[6] => BCC:
[7] => Reply name:User
[8] => Reply email:user @[at] domain [dot] com

...
[0] => An email with the details below was sent successfully:
[1] => To:user @[at] domain [dot] com
[2] => Subject:OrgName Web Contact confirmation
[3] => From name:OrgName Web Contact
[4] => From email:DoNotReply @[at] domain [dot] org
[5] => CC:
[6] => BCC:
[7] => Reply name:OrgName Web Contact
[8] => Reply email:DoNotReply @[at] domain [dot] org

...


If it would help you look at it better, I can send you the backup of the form and the URL of the form on our development site.

Thanks
GreyHead
Hi WhiteLighter01,

Please try replacing the Reply To emails with the email in the Site email settings if that is different.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
W
WhiteLighter01
Bob,

Just tested it and the error went away. Having a different Reply To email is causing the form to not send the email. I think we need to switch back to SMTP (used to work even with a different reply to using SMTP) but our server is having issues with Office 365 SMTP recently.

Thanks for helping me figure out where the problem is ^_^
GreyHead
Hi WhiteLighter01,

Hmmm . . . I'm not sure why that fixed the problem. Having a different Reply To Email and Name should be OK provided that the From Email matches the domain* and the From Name isn't empty.

Please let us know if you find anything else out.

Bob

* Sometimes the From Email has to be the same as the one in the site email settings.
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
W
WhiteLighter01
Just an update...

We moved our site to a different server and we didn't encountered the issue that I mentioned above. So I'm guessing that it has something to do with the server that we used to use.
GreyHead
Hi WhiteLighter01,

Thanks for the update.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much