I’m having a problem with this. I’m populating the db OK and receving the customers feedback form to my main email address however the customer is not getting a simple reply email to acknowledge they have filled out the form and their email address was correct.
Using Modx 0.9.6 and eForm - 1.4.4
What I’m trying to achieve is to get the email "from address" to be the person who filled out the form with their name as the "sender" & to populate the db .... (<-- this is all working) - but to also send them (the person who filled out the form) an email that comes from the sites main email address saying thanks for filling out the form (I could send them a copy of what I get easily but I don’t think it would look right sending them an email from their own address - problems with replying, etc.)
So the form page is working and I’ve added the eFormOnMailSent function, called onMailSent2Cust. I’ve even transposed the line $extraReportChunk = ’clientEmailReport’; to $extraReportChunk = ’eFeedbackReport’; incase I misunderstoon the merge part. Which, incidentally hasn’t made any difference. So here I am without the customers getting a confirmation mail, but I get one and the db is being populated. Arrrrgggghh.
On my form page
[!eForm2db!] [!eForm? &formid=`eFeedBackForm` &eFormOnBeforeMailSent=`eForm2db` &tpl=`eFeedBackForm` &thankyou=`eFeedBackThanks` &submitLimit=`0` &protectSubmit=`0` &subject=`Feedback request from [[ipaddress]]` &report=`eFeedbackReport` &fromname=`[+name+]` &from=`[+email+]` eFormOnMailSent=`onMailSent2Cust`!]
[[onMailSent2Cust]] contains
<?php
function onMailSent2Cust(&$fields){
global $modx;
//you have no access to the eform parameters here
//so you'll have to hardcode most things in this function
//There's no error checking so if things go wrong here
//you won't notice. Errors are ignored
//load extra report chunk
$extraReportChunk = 'clientEmailReport';
$mailReport = efLoadTemplate($extraReportChunk);
if( $mailReport ){
//merge placeholders
$mailReport = formMerge($mailReport,$fields);
//create and send mail
$mail = new PHPMailer();
$mail->IsMail();
$mail->CharSet = $modx->config['modx_charset'];
$mail->IsHTML(true);
$mail->From = '[email protected]';
$mail->FromName = 'Syyy Ltd';
$mail->Subject = 'Thank you for your feedback';
$mail->Body = $mailReport;
//set to address to email input field
AddAddressToMailer($mail,"to",$fields['email']);
$mail->send();
}//end if mailTemplate
//return to eForm
return true;
}
?>
{{clientEmailReport}} contains
<p>Thanks for filling out the form on the Syyy website. </p>
<p>As you have received this you should have no problems receiving our quote or any further information you may have requested</p>
Any ideas on this?