I am calling the formIt snippet via an ajax request:
$.ajax({
'type': 'post',
'contentType': 'application/x-www-form-urlencoded',
'url': '/contact/submit',
'data': $('#myForm').serialize(),
'dataType': 'json',
'timeout': 50000
}).done(function(response) {
callback(response);
}).fail(function(error) {
console.log('ERROR');
console.log(error);
});
Here is my runSnippet call:
if ( trim( filter_var( $_POST['email'], FILTER_VALIDATE_EMAIL ) ) )
{
$output = $modx->runSnippet( 'FormIt', array(
'emailTpl' => 'contactEmailTpl',
'emailTo' => '[email protected]',
'emailFrom' => '[email protected]',
'emailFromName' => 'From Name',
'emailSubject' => 'Contact Us'
) );
header( 'Content-Type: application/json' );
return json_encode( array('status' => 'success') );
}
I am getting into the the method. For example if I put a log inside the 'if', I can see it in the log. But I'm not getting any sort of email. I'm sure it's something simple I'm missing - I've been looking at this page for a long time...
Thank you for your time and suggestions!