Hi folks,
I am trying to solve this issue and now after 2 days going round in circles.
I'm using:
formit: 2.2.5-pl
modx: 2.3.3
Plesk: 12.0.18
CentOS 6.6
Postfix 2.8.17-14042513
When I fill out my form and click send, the form page is redisplayed with input content still there and the error message:
"An error occurred while trying to send the email. Could not instantiate mail function."
If I try to send the form blank, or with any combination of incorrect input content I get all the validation error messages as expected. So at this level, FormIt is acting normally.
I tried this simplified version of the form and get the same error:
[[!FormIt?
&hooks=`email`
&submitVar=`contactUsFormSubmit`
&emailTpl=`contactEmailFormIt`
&emailTo=`me@my_gmail.com`
&emailFrom=`me@my_other_email.com`
&emailFromName=`Gav`
&emailSubject=`My formit test`
&successMessage=`message sent!`
]]
<form id="contactUsForm" action="[[~[[*id]]]]" method="post">
[[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]
[[!+fi.validation_error_message]]
<div class="formRow">
<label for="name">Name:</label>
<input type="text" name="name" id="name" value="[[!+fi.name]]" />
</div>
<button type="submit" value="Send" name="contactUsFormSubmit">Send Message</button>
</form>
My mail forms worked prior to a server move, so this is likely to be a server config thing. However, modx and formit have also been updated and I need to ensure they are configured properly too.
I have tested mail sending from the server with the following script (php file in the web root, not within modx):
<?php
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "me@my_domain.com";
$to = "me@my_gmail.com";
$subject = "PHP Mail Test script";
$message = "This is a test to check PHP Mail functionality";
$headers = "From:" . $from;
mail($to,$subject,$message, $headers);
echo "Test email sent";
?>
This works and the email is received.
So I need to know what I have to check, test and reconfigure, in MODx/Plesk/server, to diagnose and make this work.
Any suggestions as to how I should proceed?
EDIT: Running this in SSH successfully sends an email to my gmail:
echo "Test mail from postfix" | mail -s "Test Postfix" me@my_gmail.com
So Postfix is working.
I suspect it's a FormIt setting that I need to change?....
[ed. note: Gav last edited this post 8 years, 10 months ago.]