I am also having an issue by not being able to set the Return-Path header. I have a client’s MODx site hosted in one place, and then the email accounts for the client in another. The eform is set to send to one of the email accounts. The email accounts are hosted by a domain/hosting company that have a strict email policy and they check to see if the Return-Path email address is a legitimate, working email address.
This results in the emails from the eform being blocked and not reaching the client’s email account.
Unfortunately for some reason, the Return-Path is not being set. We need it to be the form user’s email address.
If we put a PHP echo in the PHPMailer file (class.phpmailer.php) and we see the Return-Path is being set correctly, but for some reason it is not being transferred into the email header. Instead the Return-Path seem to default to: [HOSTING-ACCOUNT-USERNAME]@domain.co.uk
We have also tried adding the following lines of code into the eform.inc.php file:
if($sendirect) $to = $fields['email'];
$mail = new PHPMailer();
// This bit
ini_set("sendmail_from",$from);
ini_set("sendmail_path","/usr/sbin/sendmail -t -i -f ".$from);
//
$mail->IsMail();
$mail->CharSet = $modx->config['modx_charset'];
$mail->IsHTML($isHtml);
$mail->From = $from;
$mail->FromName = $fromname;
$mail->Subject = $subject;
$mail->Body = $report;
// And this bit
$mail->Sender = $from;
//
AddAddressToMailer($mail,"replyto",$replyto);
AddAddressToMailer($mail,"to",$to);
AddAddressToMailer($mail,"cc",$cc);
AddAddressToMailer($mail,"bcc",$bcc);
AttachFilesToMailer($mail,$attachments);
if(!$mail->send()) return 'Main mail: ' . $_lang['ef_mail_error'] . $mail->ErrorInfo;
Can anyone help because this is a nightmare.
We have: MODx 1.0.3, eForm 1.4.4.6, PHPMailer 1.73
Alex.
PS: we dont want to set the: var $Sender as that will be overwritten in future updates.