SendGrid - Version 1.5.3

Version Description

  • Fix attachments issue
Download this release

Release Info

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

Code changes from version 1.5.2 to 1.5.3

Files changed (3) hide show
  1. lib/overwrite-sendgrid-methods.php +47 -5
  2. readme.txt +7 -2
  3. wpsendgrid.php +28 -3
lib/overwrite-sendgrid-methods.php CHANGED
@@ -21,12 +21,54 @@ if ( ! function_exists('wp_mail'))
21
  $form['api_user'] = Sendgrid_Tools::get_username();
22
  $form['api_key'] = Sendgrid_Tools::get_password();
23
 
24
- $form = array(
25
- 'body' => $form
26
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- $response = wp_remote_post( $sendgrid->url, $form );
29
-
30
  return $response;
31
  }
32
 
21
  $form['api_user'] = Sendgrid_Tools::get_username();
22
  $form['api_key'] = Sendgrid_Tools::get_password();
23
 
24
+ $files = preg_grep( '/files/', array_keys( $form ) );
25
+
26
+ if ( count( $files) > 0 )
27
+ {
28
+ if ( in_array( 'curl', get_loaded_extensions() ) )
29
+ {
30
+ $session = curl_init( $sendgrid->url );
31
+ curl_setopt( $session, CURLOPT_POST, true );
32
+ curl_setopt( $session, CURLOPT_POSTFIELDS, $form );
33
+ curl_setopt( $session, CURLOPT_HEADER, false );
34
+ curl_setopt( $session, CURLOPT_RETURNTRANSFER, true );
35
+ curl_setopt( $session, CURLOPT_CONNECTTIMEOUT, 5 );
36
+ curl_setopt( $session, CURLOPT_TIMEOUT, 30 );
37
+ curl_setopt( $session, CURLOPT_SSL_VERIFYPEER, false);
38
+
39
+ $response = curl_exec( $session );
40
+
41
+ $response = array(
42
+ 'body' => $response
43
+ );
44
+
45
+ curl_close( $session );
46
+ }
47
+ else
48
+ {
49
+ update_option( 'sendgrid_curl_option', 'disabled' );
50
+
51
+ foreach ( $files as $key => $value )
52
+ {
53
+ unset( $form[$value] );
54
+ }
55
+
56
+ $data = array(
57
+ 'body' => $form
58
+ );
59
+
60
+ $response = wp_remote_post( $sendgrid->url, $data );
61
+ }
62
+ }
63
+ else
64
+ {
65
+ $data = array(
66
+ 'body' => $form
67
+ );
68
+
69
+ $response = wp_remote_post( $sendgrid->url, $data );
70
+ }
71
 
 
 
72
  return $response;
73
  }
74
 
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: 3.3
6
  Tested up to: 4.1.1
7
- Stable tag: 1.5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -70,8 +70,9 @@ remove_filter('wp_mail_content_type', 'set_html_content_type');`
70
  == Installation ==
71
 
72
  Requirements:
 
73
  1. PHP version >= 5.3.0
74
- 2. You need to have PHP-curl extension enabled.
75
  3. To send emails through SMTP you need to install also the 'Swift Mailer' plugin. After installing 'Swift Mailer' plugin, you must have PHP-short_open_tag setting enabled in your php.ini file.
76
 
77
  To upload the SendGrid Plugin .ZIP file:
@@ -120,6 +121,8 @@ Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" tar
120
 
121
  == Changelog ==
122
 
 
 
123
  = 1.5.2 =
124
  * Fix urlencoded username issue
125
  = 1.5.1 =
@@ -163,6 +166,8 @@ Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" tar
163
 
164
  == Upgrade notice ==
165
 
 
 
166
  = 1.5.2 =
167
  * Fix urlencoded username issue
168
  = 1.5.1 =
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: 3.3
6
  Tested up to: 4.1.1
7
+ Stable tag: 1.5.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
70
  == Installation ==
71
 
72
  Requirements:
73
+
74
  1. PHP version >= 5.3.0
75
+ 2. You need to have PHP-curl extension enabled in order to send attachments.
76
  3. To send emails through SMTP you need to install also the 'Swift Mailer' plugin. After installing 'Swift Mailer' plugin, you must have PHP-short_open_tag setting enabled in your php.ini file.
77
 
78
  To upload the SendGrid Plugin .ZIP file:
121
 
122
  == Changelog ==
123
 
124
+ = 1.5.3 =
125
+ * Fix attachments issue
126
  = 1.5.2 =
127
  * Fix urlencoded username issue
128
  = 1.5.1 =
166
 
167
  == Upgrade notice ==
168
 
169
+ = 1.5.3 =
170
+ * Fix attachments issue
171
  = 1.5.2 =
172
  * Fix urlencoded username issue
173
  = 1.5.1 =
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.5.2
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  License: GPLv2
@@ -21,9 +21,34 @@ if ( version_compare( phpversion(), '5.3.0', '<' ) ) {
21
  */
22
  function php_version_error()
23
  {
24
- echo '<div class="error"><p>'.__('SendGrid: Plugin require PHP >= 5.3.0.') . '</p></div>';
25
  }
26
- } else {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  require_once plugin_dir_path( __FILE__ ) . '/lib/class-sendgrid-tools.php';
28
  require_once plugin_dir_path( __FILE__ ) . '/lib/class-sendgrid-settings.php';
29
  require_once plugin_dir_path( __FILE__ ) . '/lib/class-sendgrid-statistics.php';
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.5.3
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  License: GPLv2
21
  */
22
  function php_version_error()
23
  {
24
+ echo '<div class="error"><p>' . __('SendGrid: Plugin require PHP >= 5.3.0.') . '</p></div>';
25
  }
26
+ }
27
+ else
28
+ {
29
+ if ( get_option( 'sendgrid_curl_option' ) !== FALSE)
30
+ {
31
+ add_action( 'admin_notices', 'sendgrid_curl_error' );
32
+
33
+ /**
34
+ * Display the notice if curl extension is not enabled
35
+ *
36
+ * return void
37
+ */
38
+ function sendgrid_curl_error()
39
+ {
40
+ if ( !in_array( 'curl', get_loaded_extensions() ) and ( get_option( 'sendgrid_curl_option' ) == 'disabled' ) )
41
+ {
42
+ echo '<div class="error"><p>' . __( 'PHP-curl extension must be enabled in order to add attachments.' ) .
43
+ '</p></div>';
44
+ }
45
+ else
46
+ {
47
+ delete_option( 'sendgrid_curl_option' );
48
+ }
49
+ }
50
+ }
51
+
52
  require_once plugin_dir_path( __FILE__ ) . '/lib/class-sendgrid-tools.php';
53
  require_once plugin_dir_path( __FILE__ ) . '/lib/class-sendgrid-settings.php';
54
  require_once plugin_dir_path( __FILE__ ) . '/lib/class-sendgrid-statistics.php';