SendinBlue Subscribe Form And WP SMTP - Version 3.1.3

Version Description

Bug fixes

  • Fixed an issue related to empty attachment while sending transactional mailing
Download this release

Release Info

Developer neeraj_slit
Plugin Icon 128x128 SendinBlue Subscribe Form And WP SMTP
Version 3.1.3
Comparing to
See all releases

Code changes from version 3.1.2 to 3.1.3

inc/SendinblueApiClient.php CHANGED
@@ -14,6 +14,7 @@ class SendinblueApiClient
14
  const RESPONSE_CODE_CREATED = 201;
15
  const RESPONSE_CODE_ACCEPTED = 202;
16
  const RESPONSE_CODE_UNAUTHORIZED = 401;
 
17
 
18
  private $apiKey;
19
  private $lastResponseCode;
@@ -125,15 +126,6 @@ class SendinblueApiClient
125
  return $this->post("/smtp/email", $data);
126
  }
127
 
128
- /**
129
- * @param $id ,$data
130
- * @return mixed
131
- */
132
- public function sendTransactionalTemplate($id, $data)
133
- {
134
- return $this->post("/smtp/templates/" . $id . "/send", $data);
135
- }
136
-
137
  /**
138
  * @param $email
139
  * @return mixed
@@ -280,6 +272,7 @@ class SendinblueApiClient
280
  'method' => $method,
281
  'headers' => [
282
  'api-key' => $this->apiKey,
 
283
  'Content-Type' => 'application/json',
284
  'User-Agent' => 'sendinblue_plugins/wordpress'
285
  ],
14
  const RESPONSE_CODE_CREATED = 201;
15
  const RESPONSE_CODE_ACCEPTED = 202;
16
  const RESPONSE_CODE_UNAUTHORIZED = 401;
17
+ const PLUGIN_VERSION = '3.1.3';
18
 
19
  private $apiKey;
20
  private $lastResponseCode;
126
  return $this->post("/smtp/email", $data);
127
  }
128
 
 
 
 
 
 
 
 
 
 
129
  /**
130
  * @param $email
131
  * @return mixed
272
  'method' => $method,
273
  'headers' => [
274
  'api-key' => $this->apiKey,
275
+ 'sib-plugin' => 'wp-'.self::PLUGIN_VERSION,
276
  'Content-Type' => 'application/json',
277
  'User-Agent' => 'sendinblue_plugins/wordpress'
278
  ],
inc/sib-api-manager.php CHANGED
@@ -607,35 +607,27 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
607
  $home_settings = get_option( SIB_Manager::HOME_OPTION_NAME );
608
  if ( 'yes' == $home_settings['activate_email'] ) {
609
 
610
- if ( intval( $template_id ) > 0 && is_array( $attributes ) && ( 'confirm' == $type ) ) {
611
- $attrs = array_merge(
612
- $attributes, array(
613
- 'EMAIL' => $to_email,
614
- )
615
- );
 
 
 
 
616
 
617
- $res = $mailin->sendTransactionalTemplate( intval( $template_id ),['emailTo' => [$to_email]]);
 
618
  } else {
 
 
 
 
619
 
620
- $data = [
621
- 'sender' => [
622
- 'email' => $from[0],
623
- 'name' => $from[1],
624
- ],
625
- 'replyTo' => [
626
- 'email' => $from[0],
627
- ],
628
- 'to' => [
629
- [
630
- 'email' => $to_email
631
- ]
632
- ],
633
- 'subject' => $subject,
634
- 'htmlContent' => $html_content
635
- ];
636
 
637
- $res = $mailin->sendEmail( $data );
638
- }
639
  } else {
640
  $headers[] = 'Content-Type: text/html; charset=UTF-8';
641
  $headers[] = "From: $sender_name <$sender_email>";
607
  $home_settings = get_option( SIB_Manager::HOME_OPTION_NAME );
608
  if ( 'yes' == $home_settings['activate_email'] ) {
609
 
610
+ $data = [
611
+ 'replyTo' => [
612
+ 'email' => $from[0],
613
+ ],
614
+ 'to' => [
615
+ [
616
+ 'email' => $to_email
617
+ ]
618
+ ]
619
+ ];
620
 
621
+ if ( intval( $template_id ) > 0 && ( 'confirm' == $type ) ) {
622
+ $data["templateId"] = intval( $template_id );
623
  } else {
624
+ $data['sender'] = [ 'email' => $from[0], 'name' => $from[1] ];
625
+ $data['htmlContent'] = $html_content;
626
+ $data['subject'] = $subject;
627
+ }
628
 
629
+ $res = $mailin->sendEmail( $data );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
630
 
 
 
631
  } else {
632
  $headers[] = 'Content-Type: text/html; charset=UTF-8';
633
  $headers[] = "From: $sender_name <$sender_email>";
readme.txt CHANGED
@@ -115,6 +115,11 @@ In order to create a signup form, you need to:
115
 
116
  == Changelog ==
117
 
 
 
 
 
 
118
  = 3.1.2 =
119
  **Bug fixes**
120
 
115
 
116
  == Changelog ==
117
 
118
+ = 3.1.3 =
119
+ **Bug fixes**
120
+
121
+ * Fixed an issue related to empty attachment while sending transactional mailing
122
+
123
  = 3.1.2 =
124
  **Bug fixes**
125
 
sendinblue.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue
4
  * Plugin URI: https://www.sendinblue.com/?r=wporg
5
  * Description: Manage your contact lists, subscription forms and all email and marketing-related topics from your wp panel, within one single plugin
6
- * Version: 3.1.2
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later
@@ -819,7 +819,7 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
819
  // Compact the input, apply the filters, and extract them back out.
820
  extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
821
 
822
- if ( ! is_array( $attachments ) ) {
823
  $attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) );
824
  }
825
 
@@ -954,12 +954,16 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
954
  $attachment_content = array();
955
  if ( ! empty( $attachments ) ) {
956
  foreach ( $attachments as $attachment ) {
957
- $content = self::getAttachmentStruct( $attachment );
958
- if ( ! is_wp_error( $content ) ) {
959
- $attachment_content = array_merge( $attachment_content, $content );
 
 
960
  }
961
  }
962
- $data["attachment"] = array($attachment_content);
 
 
963
  }
964
 
965
  // Common transformations for the HTML part.
3
  * Plugin Name: Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue
4
  * Plugin URI: https://www.sendinblue.com/?r=wporg
5
  * Description: Manage your contact lists, subscription forms and all email and marketing-related topics from your wp panel, within one single plugin
6
+ * Version: 3.1.3
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later
819
  // Compact the input, apply the filters, and extract them back out.
820
  extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
821
 
822
+ if ( !empty( $attachments ) && ! is_array( $attachments ) ) {
823
  $attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) );
824
  }
825
 
954
  $attachment_content = array();
955
  if ( ! empty( $attachments ) ) {
956
  foreach ( $attachments as $attachment ) {
957
+ if ( !empty( $attachment ) ) {
958
+ $content = self::getAttachmentStruct( $attachment );
959
+ if ( ! is_wp_error( $content ) ) {
960
+ $attachment_content = array_merge( $attachment_content, $content );
961
+ }
962
  }
963
  }
964
+ if ( !empty( $attachment_content ) ) {
965
+ $data["attachment"] = array($attachment_content);
966
+ }
967
  }
968
 
969
  // Common transformations for the HTML part.