Skip to content

Commit

Permalink
Fix bug with wp_mail filter. release new version
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-mykhailenko committed Dec 14, 2022
1 parent 577a190 commit 9b0ce7c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Changelog
=========
1.8.9 (2022-12-14)
- Fixed bug with removed wp_mail filter

1.8.8 (2022-12-11)
- Fixed bug when `$to` override in the `wp_mail` function

Expand Down
18 changes: 7 additions & 11 deletions includes/wp-mail-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,38 +130,34 @@ function wp_mail($to, $subject, $message, $headers = '', $attachments = array())
// Respect WordPress core filters
$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );

if ( isset( $atts['to'] ) ) {
if (isset($atts['to'])) {
$to = $atts['to'];
}

if ( ! is_array( $to ) ) {
$to = explode( ',', $to );
if (!is_array($to)) {
$to = explode(',', $to);
}

if ( isset( $atts['subject'] ) ) {
if (isset($atts['subject'])) {
$subject = $atts['subject'];
}

if ( isset( $atts['message'] ) ) {
if (isset($atts['message'])) {
$message = $atts['message'];
}

if ( isset( $atts['headers'] ) ) {
if (isset($atts['headers'])) {
$headers = $atts['headers'];
}

if ( isset( $atts['attachments'] ) ) {
if (isset($atts['attachments'])) {
$attachments = $atts['attachments'];
}

if (!is_array($attachments)) {
$attachments = explode("\n", str_replace("\r\n", "\n", $attachments));
}

if (!is_array($attachments)) {
$attachments = explode("\n", str_replace("\r\n", "\n", $attachments));
}

// Headers
if (empty($headers)) {
$headers = [];
Expand Down
2 changes: 1 addition & 1 deletion mailgun.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Mailgun
* Plugin URI: http://wordpress.org/extend/plugins/mailgun/
* Description: Mailgun integration for WordPress
* Version: 1.8.8
* Version: 1.8.9
* Tested up to: 6.1
* Author: Mailgun
* Author URI: http://www.mailgun.com/
Expand Down
5 changes: 4 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Contributors: mailgun, sivel, lookahead.io, m35dev
Tags: mailgun, smtp, http, api, mail, email
Requires at least: 3.3
Tested up to: 6.1
Stable tag: 1.8.8
Stable tag: 1.8.9
Requires PHP: 5.6
License: GPLv2 or later

Expand Down Expand Up @@ -130,6 +130,9 @@ MAILGUN_FROM_ADDRESS Type: string


== Changelog ==
= 1.8.9 (2022-12-14): =
- Fixed bug with removed wp_mail filter

= 1.8.8 (2022-12-11): =
- Fixed bug when `$to` override in the `wp_mail` function

Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Contributors: mailgun, sivel, lookahead.io, m35dev
Tags: mailgun, smtp, http, api, mail, email
Requires at least: 4.4
Tested up to: 6.1
Stable tag: 1.8.8
Stable tag: 1.8.9
Requires PHP: 5.6
License: GPLv2 or later

Expand Down Expand Up @@ -128,6 +128,9 @@ MAILGUN_FROM_ADDRESS Type: string


== Changelog ==
= 1.8.8 (2022-12-14): =
- Fixed bug with removed wp_mail filter

= 1.8.7 (2022-11-12): =
- Fixed bug when field `Override "From" Details` was not updated

Expand Down

0 comments on commit 9b0ce7c

Please sign in to comment.