Skip to content

Commit

Permalink
BP 2.5: Set the 'Reply-To' email header in a different way.
Browse files Browse the repository at this point in the history
The BP_PHPMailer class uses PHPMailer's addReplyTo() method to set the
'Reply-To' email header.  This method has a bug where it will not add
email addresses with a mailbox larger than 64 characters. See:
github.com/PHPMailer/PHPMailer/issues/706 for more details.

In cases where RBE's Reply-To email address mailbox might surpass 64
characters, BP_PHPMailer would silently discard our Reply-To email
address!

To workaround this bug, we're wiping out the Reply-To header and re-adding
it with custom email headers, which bypasses PHPMailer's validation
address checks.

See #75.
  • Loading branch information
r-a-y committed May 6, 2016
1 parent cebeb10 commit f297579
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bp-rbe-core.php
Expand Up @@ -240,8 +240,18 @@ public function set_bp_reply_to( $email_type, $email ) {
return;
}

// Set our custom 'Reply-To' email header.
$email->set_reply_to( $reply_to );
/**
* Set our custom 'Reply-To' email header.
*
* Have to workaround a mailbox character limit PHPMailer bug by wiping out
* the Reply-To header and then setting it as a custom header.
*
* @link https://github.com/PHPMailer/PHPMailer/issues/706
*/
$email->set_reply_to( '' );
$email->set_headers( array(
'Reply-To' => $reply_to
) );
}

/**
Expand Down

0 comments on commit f297579

Please sign in to comment.