Email blocked by ISP (code change in post)

Rick
Rick
Offline
0
When I changed the configuration of a form to copy the submitter, I no longer was getting the email with the submitted form information (I didn't see the problem until I enabled sending a copy to the submitter). I tried a variety of settings, but could not make it work.

What I discovered was that for the email with the submission, the submitter's email was being used for both the "From:" and "Reply-To:" fields. My ISP will block an email for which the "From:" is not a local email address for the domain. So those emails never arrived. Only the submitter's copy was delivered.

The only way I could fix this was to make a code change to b2jadminmailer.php. What I did was pull the "From:" address to use the same value that b2jsubmittermailer.php uses, and I left the "Reply-To:" as the submitter's email. In b2jadminmailer.php, I changed the set_from method as follows:

private function set_from(&$mail)
{
// RJMc (20140830): Pull the "From:" address from the same place as
// b2jsubmittermailer.php gets it.
$emailhelper = new B2jEmailHelper($this->Params);
$config = JComponentHelper::getParams("com_b2jcontact");

$submitteremailfrom = $config->get("submitteremailfrom");
$from = $emailhelper->convert($submitteremailfrom);
$adminemailreplyto = array();
$replayTo = array();
if (!isset($this->FieldsBuilder->senderEmail->b2jFieldValue) || empty($this->FieldsBuilder->senderEmail->b2jFieldValue)){
$adminemailreplyto['0'] = "";
$replayTo[] = '';
}else{
// $adminemailreplyto['0'] = $this->FieldsBuilder->senderEmail->b2jFieldValue;
// RJMc (20140830): Stuff a different value into the "From:", but
// leave "Reply-To:" the way it was before.
$adminemailreplyto['0'] = $from;
$replayTo[] = $this->FieldsBuilder->senderEmail->b2jFieldValue;
}
$replayTo[] = 'User';
$adminemailreplyto['1'] = "User";

$mail->setSender($adminemailreplyto);
$mail->ClearReplyTos();
$mail->addReplyTo($replayTo);
}

This may or may not be the best fix, but it works for my situation. I really would prefer not to have to maintain one-off code for this - perhaps I am not configuring properly?
Responses (1)
Sorry, but you are not allowed to view the replies here.
Your Reply

Cron Job Starts