Skip to content

Commit

Permalink
Minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rajumsys committed Aug 23, 2016
1 parent 89bffb8 commit 029eac8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions mailer.http.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,12 @@ protected function get_request_headers($hide_api_key = false)
}

/**
* Returns the list of Reply-To headers
* Returns the list of Reply-To recipients
* For WordPress version below 4.6
* @return array
* TODO Remove this when wordpress does not support version below 4.6
*/
protected function get_reply_to_below46()
protected function parse_reply_to_from_custom_header()
{
$replyTos = array();
foreach ($this->CustomHeader as $header) { // wp_mail sets Reply-To as custom header (does not use phpmailer->addReplyTo)
Expand All @@ -278,7 +278,7 @@ protected function get_reply_to_below46()
* For WordPress 4.6 and above
* @return array Formatted list of reply tos
*/
protected function get_reply_to_above46()
protected function parse_reply_to()
{
$replyTos = array();
foreach ($this->ReplyTo as $reply_to) {
Expand All @@ -294,12 +294,13 @@ protected function get_reply_to_above46()
return implode(',', $replyTos);
}

protected function get_reply_to() {
protected function get_reply_to()
{
$wp_version = get_bloginfo('version');
if(version_compare($wp_version, '4.6') == -1) { // if lower than 4.6
return $this->get_reply_to_below46();
return $this->parse_reply_to_from_custom_header();
} else {
return $this->get_reply_to_above46();
return $this->parse_reply_to();
}
}

Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: sparkpost, rajuru
Tags: sparkpost, smtp, wp_mail, mail, email
Requires at least: 4.0
Tested up to: 4.6
Stable tag: 2.4.0
Stable tag: 2.4.1
License: GPLv2 or later

Send all your email from WordPress through SparkPost, the most advanced email delivery service.
Expand Down Expand Up @@ -48,7 +48,7 @@ Visit our [support site](https://support.sparkpost.com/) for help.
== Changelog ==

= 2.4.1=
- Fix ReplyTo header issue with WordPress 4.6
- Fix Reply-To header issue with WordPress 4.6

= 2.4.0 =
- Add supports for CC and BCC using HTTP API
Expand Down

0 comments on commit 029eac8

Please sign in to comment.