SendGrid - Version 1.11.6

Version Description

  • Added a feature flag to disable whitespace normalization in BuddyPress plaintext emails
  • Fixed an issue where the from name and email subjects would incorrectly display the ampersand symbol
Download this release

Release Info

Developer team-rs
Plugin Icon 128x128 SendGrid
Version 1.11.6
Comparing to
See all releases

Code changes from version 1.11.5 to 1.11.6

lib/class-sendgrid-mc-optin.php CHANGED
@@ -121,9 +121,9 @@ class Sendgrid_OptIn_API_Endpoint{
121
  return false;
122
  }
123
 
124
- $subject = stripslashes( $subject );
125
- $content = stripslashes( $content );
126
- $content_text = stripslashes( $content_text );
127
  $to = array( $email );
128
 
129
  $token = Sendgrid_OptIn_API_Endpoint::generate_email_token( $email, $first_name, $last_name );
121
  return false;
122
  }
123
 
124
+ $subject = htmlspecialchars_decode( $subject );
125
+ $content = htmlspecialchars_decode( $content );
126
+ $content_text = htmlspecialchars_decode( $content_text );
127
  $to = array( $email );
128
 
129
  $token = Sendgrid_OptIn_API_Endpoint::generate_email_token( $email, $first_name, $last_name );
lib/integration/class-buddypress-override.php CHANGED
@@ -13,6 +13,10 @@ class SendGrid_BuddyPress_Mailer implements BP_Email_Delivery {
13
  $subject = $email->get_subject( 'replace-tokens' );
14
  $message = normalize_whitespace( $email->get_content_plaintext( 'replace-tokens' ) );
15
 
 
 
 
 
16
  $filter_set = false;
17
 
18
  if ( 'plaintext' != Sendgrid_Tools::get_content_type() ) {
@@ -29,7 +33,7 @@ class SendGrid_BuddyPress_Mailer implements BP_Email_Delivery {
29
 
30
  return $result;
31
  }
32
-
33
  function set_html_content_type( $content_type ) {
34
  return 'text/html';
35
  }
13
  $subject = $email->get_subject( 'replace-tokens' );
14
  $message = normalize_whitespace( $email->get_content_plaintext( 'replace-tokens' ) );
15
 
16
+ if ( defined( 'SENDGRID_DISABLE_BP_NORMALIZE_WHITESPACE' ) ) {
17
+ $message = $email->get_content_plaintext( 'replace-tokens' );
18
+ }
19
+
20
  $filter_set = false;
21
 
22
  if ( 'plaintext' != Sendgrid_Tools::get_content_type() ) {
33
 
34
  return $result;
35
  }
36
+
37
  function set_html_content_type( $content_type ) {
38
  return 'text/html';
39
  }
lib/sendgrid/sendgrid-wp-mail.php CHANGED
@@ -39,7 +39,7 @@ require_once plugin_dir_path( __FILE__ ) . 'class-sendgrid-php.php';
39
  function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() )
40
  {
41
  $header_is_object = false;
42
-
43
  if ( $headers instanceof SendGrid\Email ) {
44
  $header_is_object = true;
45
 
@@ -54,7 +54,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
54
  // Compact the input, apply the filters, and extract them back out
55
  extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
56
  }
57
-
58
  $method = Sendgrid_Tools::get_send_method();
59
 
60
  // prepare attachments
@@ -173,7 +173,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
173
  if ( false !== strpos( $content, '=' ) ) {
174
  list( $key, $val ) = explode( '=', $unique_arg );
175
  $mail->addUniqueArg( trim( $key ), trim( $val ) );
176
- }
177
  }
178
  break;
179
  case 'template':
@@ -207,7 +207,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
207
  if ( false !== strpos( $content, '=' ) ) {
208
  list( $key, $val ) = explode( '=', $substitution );
209
  $mail->addSubstitution( '%' . trim( $key ) . '%', explode( ',', trim( $val ) ) );
210
- }
211
  }
212
  break;
213
  case 'sections':
@@ -221,7 +221,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
221
  if ( false !== strpos( $content, '=' ) ) {
222
  list( $key, $val ) = explode( '=', $section );
223
  $mail->addSection( '%' . trim( $key ) . '%', trim( $val ) );
224
- }
225
  }
226
  break;
227
  default:
@@ -236,8 +236,9 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
236
 
237
  // From email and name
238
  // If we don't have a name from the input headers
239
- if ( ! isset( $from_name ) or ! $from_name )
240
- $from_name = stripslashes( Sendgrid_Tools::get_from_name() );
 
241
 
242
  /* If we don't have an email from the input headers default to wordpress@$sitename
243
  * Some hosts will block outgoing mail from this address if it doesn't exist but
@@ -312,7 +313,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
312
  if ( ! ( $global_content_type ) or ( 'plaintext' == $global_content_type ) ) {
313
  $content_type = 'text/plain';
314
  } elseif ( 'html' == $global_content_type ) {
315
- $content_type = 'text/html';
316
  } else {
317
  $content_type = 'text/plain';
318
  }
@@ -392,7 +393,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
392
  }
393
 
394
  $mail->setReplyTo( $replyto );
395
-
396
  // add attachemnts
397
  if ( count( $attached_files ) ) {
398
  $mail->setAttachments( $attached_files );
@@ -412,7 +413,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
412
 
413
  return $sendgrid->send( $mail );
414
  }
415
-
416
 
417
  if ( ! function_exists( 'set_html_content_type' ) )
418
  {
39
  function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() )
40
  {
41
  $header_is_object = false;
42
+
43
  if ( $headers instanceof SendGrid\Email ) {
44
  $header_is_object = true;
45
 
54
  // Compact the input, apply the filters, and extract them back out
55
  extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
56
  }
57
+
58
  $method = Sendgrid_Tools::get_send_method();
59
 
60
  // prepare attachments
173
  if ( false !== strpos( $content, '=' ) ) {
174
  list( $key, $val ) = explode( '=', $unique_arg );
175
  $mail->addUniqueArg( trim( $key ), trim( $val ) );
176
+ }
177
  }
178
  break;
179
  case 'template':
207
  if ( false !== strpos( $content, '=' ) ) {
208
  list( $key, $val ) = explode( '=', $substitution );
209
  $mail->addSubstitution( '%' . trim( $key ) . '%', explode( ',', trim( $val ) ) );
210
+ }
211
  }
212
  break;
213
  case 'sections':
221
  if ( false !== strpos( $content, '=' ) ) {
222
  list( $key, $val ) = explode( '=', $section );
223
  $mail->addSection( '%' . trim( $key ) . '%', trim( $val ) );
224
+ }
225
  }
226
  break;
227
  default:
236
 
237
  // From email and name
238
  // If we don't have a name from the input headers
239
+ if ( ! isset( $from_name ) or ! $from_name ) {
240
+ $from_name = htmlspecialchars_decode( Sendgrid_Tools::get_from_name() );
241
+ }
242
 
243
  /* If we don't have an email from the input headers default to wordpress@$sitename
244
  * Some hosts will block outgoing mail from this address if it doesn't exist but
313
  if ( ! ( $global_content_type ) or ( 'plaintext' == $global_content_type ) ) {
314
  $content_type = 'text/plain';
315
  } elseif ( 'html' == $global_content_type ) {
316
+ $content_type = 'text/html';
317
  } else {
318
  $content_type = 'text/plain';
319
  }
393
  }
394
 
395
  $mail->setReplyTo( $replyto );
396
+
397
  // add attachemnts
398
  if ( count( $attached_files ) ) {
399
  $mail->setAttachments( $attached_files );
413
 
414
  return $sendgrid->send( $mail );
415
  }
416
+
417
 
418
  if ( ! function_exists( 'set_html_content_type' ) )
419
  {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://sendgrid.com/
4
  Tags: email, email reliability, email templates, sendgrid, smtp, transactional email, wp_mail,email infrastructure, email marketing, marketing email, deliverability, email deliverability, email delivery, email server, mail server, email integration, cloud email
5
  Requires at least: 4.6
6
  Tested up to: 4.8
7
- Stable tag: 1.11.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -232,6 +232,14 @@ Yes. Our plugin required special integration with BuddyPress and it's regularly
232
 
233
  `define('SENDGRID_DISABLE_BUDDYPRESS', '1');`
234
 
 
 
 
 
 
 
 
 
235
  = Can I use shortcodes to customize the subscription confirmation page ? =
236
 
237
  Yes. You need to create custom page and select it from the settings page. You can place any of these shortcodes in the body of that page. Here's an example :
@@ -284,6 +292,9 @@ You can find more examples here: https://github.com/sendgrid/sendgrid-php/blob/v
284
 
285
  == Changelog ==
286
 
 
 
 
287
  = 1.11.5 =
288
  * Fixed a potential stored XSS issue on the backend settings form
289
  * Fixed a potential CSRF issue on the backend settings form
@@ -461,6 +472,9 @@ You can find more examples here: https://github.com/sendgrid/sendgrid-php/blob/v
461
 
462
  == Upgrade notice ==
463
 
 
 
 
464
  = 1.11.5 =
465
  * Fixed a potential stored XSS issue on the backend settings form
466
  * Fixed a potential CSRF issue on the backend settings form
4
  Tags: email, email reliability, email templates, sendgrid, smtp, transactional email, wp_mail,email infrastructure, email marketing, marketing email, deliverability, email deliverability, email delivery, email server, mail server, email integration, cloud email
5
  Requires at least: 4.6
6
  Tested up to: 4.8
7
+ Stable tag: 1.11.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
232
 
233
  `define('SENDGRID_DISABLE_BUDDYPRESS', '1');`
234
 
235
+ If you're trying to send plaintext emails using BuddyPress, keep in mind that by default the whitespace content of those emails is normalized.
236
+
237
+ That means that some newlines might be missing if you expect them to be there.
238
+
239
+ To disable this functionality, you need to add the following line in your wp-config.php file:
240
+
241
+ `define('SENDGRID_DISABLE_BP_NORMALIZE_WHITESPACE', '1');`
242
+
243
  = Can I use shortcodes to customize the subscription confirmation page ? =
244
 
245
  Yes. You need to create custom page and select it from the settings page. You can place any of these shortcodes in the body of that page. Here's an example :
292
 
293
  == Changelog ==
294
 
295
+ = 1.11.6 =
296
+ * Added a feature flag to disable whitespace normalization in BuddyPress plaintext emails
297
+ * Fixed an issue where the from name and email subjects would incorrectly display the ampersand symbol
298
  = 1.11.5 =
299
  * Fixed a potential stored XSS issue on the backend settings form
300
  * Fixed a potential CSRF issue on the backend settings form
472
 
473
  == Upgrade notice ==
474
 
475
+ = 1.11.6 =
476
+ * Added a feature flag to disable whitespace normalization in BuddyPress plaintext emails
477
+ * Fixed an issue where the from name and email subjects would incorrectly display the ampersand symbol
478
  = 1.11.5 =
479
  * Fixed a potential stored XSS issue on the backend settings form
480
  * Fixed a potential CSRF issue on the backend settings form
wpsendgrid.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: SendGrid
4
  Plugin URI: http://wordpress.org/plugins/sendgrid-email-delivery-simplified/
5
  Description: Email Delivery. Simplified. SendGrid's cloud-based email infrastructure relieves businesses of the cost and complexity of maintaining custom email systems. SendGrid provides reliable delivery, scalability and real-time analytics along with flexible APIs that make custom integration a breeze.
6
- Version: 1.11.5
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  Text Domain: sendgrid-email-delivery-simplified
3
  Plugin Name: SendGrid
4
  Plugin URI: http://wordpress.org/plugins/sendgrid-email-delivery-simplified/
5
  Description: Email Delivery. Simplified. SendGrid's cloud-based email infrastructure relieves businesses of the cost and complexity of maintaining custom email systems. SendGrid provides reliable delivery, scalability and real-time analytics along with flexible APIs that make custom integration a breeze.
6
+ Version: 1.11.6
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  Text Domain: sendgrid-email-delivery-simplified