Version Description
- Added a configuration parameter of API request timeout in seconds
- Fixed an issue that made the HTML subscription emails break links
Download this release
Release Info
Developer | team-rs |
Plugin | SendGrid |
Version | 1.11.7 |
Comparing to | |
See all releases |
Code changes from version 1.11.6 to 1.11.7
- lib/class-sendgrid-mc-optin.php +3 -3
- lib/class-sendgrid-nlvx.php +6 -3
- lib/class-sendgrid-tools.php +26 -3
- lib/sendgrid/class-sendgrid-api.php +6 -5
- readme.txt +18 -1
- wpsendgrid.php +1 -1
lib/class-sendgrid-mc-optin.php
CHANGED
@@ -121,9 +121,9 @@ class Sendgrid_OptIn_API_Endpoint{
|
|
121 |
return false;
|
122 |
}
|
123 |
|
124 |
-
$subject =
|
125 |
-
$content =
|
126 |
-
$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 = 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 );
|
lib/class-sendgrid-nlvx.php
CHANGED
@@ -46,7 +46,8 @@ class Sendgrid_NLVX
|
|
46 |
'headers' => array(
|
47 |
'Authorization' => $auth
|
48 |
),
|
49 |
-
'decompress' => false
|
|
|
50 |
);
|
51 |
|
52 |
$url = Sendgrid_NLVX::NLVX_API_URL . '/lists';
|
@@ -86,7 +87,8 @@ class Sendgrid_NLVX
|
|
86 |
'headers' => array(
|
87 |
'Authorization' => $auth
|
88 |
),
|
89 |
-
'decompress' => false
|
|
|
90 |
);
|
91 |
|
92 |
$url = Sendgrid_NLVX::NLVX_API_URL . '/recipients';
|
@@ -142,7 +144,8 @@ class Sendgrid_NLVX
|
|
142 |
'headers' => array(
|
143 |
'Authorization' => $auth
|
144 |
),
|
145 |
-
'decompress' => false
|
|
|
146 |
);
|
147 |
|
148 |
$url = Sendgrid_NLVX::NLVX_API_URL . '/lists/'. $list_id . '/recipients/' . $recipient_id;
|
46 |
'headers' => array(
|
47 |
'Authorization' => $auth
|
48 |
),
|
49 |
+
'decompress' => false,
|
50 |
+
'timeout' => Sendgrid_Tools::get_request_timeout()
|
51 |
);
|
52 |
|
53 |
$url = Sendgrid_NLVX::NLVX_API_URL . '/lists';
|
87 |
'headers' => array(
|
88 |
'Authorization' => $auth
|
89 |
),
|
90 |
+
'decompress' => false,
|
91 |
+
'timeout' => Sendgrid_Tools::get_request_timeout()
|
92 |
);
|
93 |
|
94 |
$url = Sendgrid_NLVX::NLVX_API_URL . '/recipients';
|
144 |
'headers' => array(
|
145 |
'Authorization' => $auth
|
146 |
),
|
147 |
+
'decompress' => false,
|
148 |
+
'timeout' => Sendgrid_Tools::get_request_timeout()
|
149 |
);
|
150 |
|
151 |
$url = Sendgrid_NLVX::NLVX_API_URL . '/lists/'. $list_id . '/recipients/' . $recipient_id;
|
lib/class-sendgrid-tools.php
CHANGED
@@ -7,6 +7,7 @@ class Sendgrid_Tools
|
|
7 |
const CHECK_API_KEY_CACHE_KEY = "sendgrid_api_key_check";
|
8 |
const CHECK_API_KEY_STATS_CACHE_KEY = "sendgrid_api_key_stats_check";
|
9 |
const VALID_CREDENTIALS_STATUS = "valid";
|
|
|
10 |
|
11 |
// used static variable because php 5.3 doesn't support array as constant
|
12 |
public static $allowed_ports = array( Sendgrid_SMTP::TLS, Sendgrid_SMTP::TLS_ALTERNATIVE, Sendgrid_SMTP::SSL, Sendgrid_SMTP::TLS_ALTERNATIVE_2 );
|
@@ -78,7 +79,13 @@ class Sendgrid_Tools
|
|
78 |
$url = 'https://api.sendgrid.com/api/profile.get.json?';
|
79 |
$url .= "api_user=" . urlencode( $username ) . "&api_key=" . urlencode( $password );
|
80 |
|
81 |
-
$response = wp_remote_get(
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
if ( ! is_array( $response ) or ! isset( $response['body'] ) ) {
|
84 |
return false;
|
@@ -113,7 +120,8 @@ class Sendgrid_Tools
|
|
113 |
$args = array(
|
114 |
'headers' => array(
|
115 |
'Authorization' => 'Bearer ' . $apikey ),
|
116 |
-
'decompress' => false
|
|
|
117 |
);
|
118 |
|
119 |
$response = wp_remote_get( $url, $args );
|
@@ -223,7 +231,8 @@ class Sendgrid_Tools
|
|
223 |
'headers' => array(
|
224 |
'Authorization' => 'Bearer ' . self::get_api_key()
|
225 |
),
|
226 |
-
'decompress' => false
|
|
|
227 |
);
|
228 |
|
229 |
$data = urldecode( http_build_query( $parameters ) );
|
@@ -1424,6 +1433,20 @@ class Sendgrid_Tools
|
|
1424 |
|
1425 |
return $pagination;
|
1426 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1427 |
}
|
1428 |
|
1429 |
/**
|
7 |
const CHECK_API_KEY_CACHE_KEY = "sendgrid_api_key_check";
|
8 |
const CHECK_API_KEY_STATS_CACHE_KEY = "sendgrid_api_key_stats_check";
|
9 |
const VALID_CREDENTIALS_STATUS = "valid";
|
10 |
+
const DEFAULT_TIMEOUT = 5;
|
11 |
|
12 |
// used static variable because php 5.3 doesn't support array as constant
|
13 |
public static $allowed_ports = array( Sendgrid_SMTP::TLS, Sendgrid_SMTP::TLS_ALTERNATIVE, Sendgrid_SMTP::SSL, Sendgrid_SMTP::TLS_ALTERNATIVE_2 );
|
79 |
$url = 'https://api.sendgrid.com/api/profile.get.json?';
|
80 |
$url .= "api_user=" . urlencode( $username ) . "&api_key=" . urlencode( $password );
|
81 |
|
82 |
+
$response = wp_remote_get(
|
83 |
+
$url,
|
84 |
+
array(
|
85 |
+
'decompress' => false,
|
86 |
+
'timeout' => Sendgrid_Tools::get_request_timeout()
|
87 |
+
)
|
88 |
+
);
|
89 |
|
90 |
if ( ! is_array( $response ) or ! isset( $response['body'] ) ) {
|
91 |
return false;
|
120 |
$args = array(
|
121 |
'headers' => array(
|
122 |
'Authorization' => 'Bearer ' . $apikey ),
|
123 |
+
'decompress' => false,
|
124 |
+
'timeout' => Sendgrid_Tools::get_request_timeout()
|
125 |
);
|
126 |
|
127 |
$response = wp_remote_get( $url, $args );
|
231 |
'headers' => array(
|
232 |
'Authorization' => 'Bearer ' . self::get_api_key()
|
233 |
),
|
234 |
+
'decompress' => false,
|
235 |
+
'timeout' => Sendgrid_Tools::get_request_timeout()
|
236 |
);
|
237 |
|
238 |
$data = urldecode( http_build_query( $parameters ) );
|
1433 |
|
1434 |
return $pagination;
|
1435 |
}
|
1436 |
+
|
1437 |
+
/**
|
1438 |
+
* Returns configured timeout for API requests
|
1439 |
+
*
|
1440 |
+
* @return integer timeout in seconds
|
1441 |
+
*/
|
1442 |
+
public static function get_request_timeout()
|
1443 |
+
{
|
1444 |
+
if ( defined( 'SENDGRID_REQUEST_TIMEOUT' ) ) {
|
1445 |
+
return SENDGRID_REQUEST_TIMEOUT;
|
1446 |
+
} else {
|
1447 |
+
return self::DEFAULT_TIMEOUT;
|
1448 |
+
}
|
1449 |
+
}
|
1450 |
}
|
1451 |
|
1452 |
/**
|
lib/sendgrid/class-sendgrid-api.php
CHANGED
@@ -25,25 +25,26 @@ class Sendgrid_API implements Sendgrid_Send {
|
|
25 |
|
26 |
public function send(SendGrid\Email $email) {
|
27 |
$data = array(
|
28 |
-
'headers' => array(
|
29 |
'Content-Type' => 'application/json',
|
30 |
'User-Agent' => 'sendgrid/wordpress;php',
|
31 |
'Authorization' => 'Bearer ' . $this->apikey
|
32 |
),
|
33 |
'body' => Sendgrid_Translator::to_api_v3( $email ),
|
34 |
-
'decompress' => false
|
|
|
35 |
);
|
36 |
|
37 |
// Send the request
|
38 |
$response = wp_remote_post( self::URL, $data );
|
39 |
|
40 |
// Check that the response fields are set
|
41 |
-
if ( !is_array( $response ) or
|
42 |
-
!isset( $response['response'] ) or
|
43 |
!isset( $response['response']['code'] ) ) {
|
44 |
return false;
|
45 |
}
|
46 |
-
|
47 |
// Check for success code range (200-299)
|
48 |
$response_code = (int) $response['response']['code'];
|
49 |
if ( $response_code >= 200 and
|
25 |
|
26 |
public function send(SendGrid\Email $email) {
|
27 |
$data = array(
|
28 |
+
'headers' => array(
|
29 |
'Content-Type' => 'application/json',
|
30 |
'User-Agent' => 'sendgrid/wordpress;php',
|
31 |
'Authorization' => 'Bearer ' . $this->apikey
|
32 |
),
|
33 |
'body' => Sendgrid_Translator::to_api_v3( $email ),
|
34 |
+
'decompress' => false,
|
35 |
+
'timeout' => Sendgrid_Tools::get_request_timeout()
|
36 |
);
|
37 |
|
38 |
// Send the request
|
39 |
$response = wp_remote_post( self::URL, $data );
|
40 |
|
41 |
// Check that the response fields are set
|
42 |
+
if ( !is_array( $response ) or
|
43 |
+
!isset( $response['response'] ) or
|
44 |
!isset( $response['response']['code'] ) ) {
|
45 |
return false;
|
46 |
}
|
47 |
+
|
48 |
// Check for success code range (200-299)
|
49 |
$response_code = (int) $response['response']['code'];
|
50 |
if ( $response_code >= 200 and
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -100,6 +100,9 @@ SendGrid settings can optionally be defined as global variables (wp-config.php):
|
|
100 |
* Signup confirmation email content: define('SENDGRID_MC_SIGNUP_EMAIL_CONTENT', '<a href="%confirmation_link%">click here</a>');
|
101 |
* Signup confirmation page ID: define('SENDGRID_MC_SIGNUP_CONFIRMATION_PAGE', 'page_id');
|
102 |
|
|
|
|
|
|
|
103 |
= Filters =
|
104 |
|
105 |
Use HTML content type for a single email:
|
@@ -276,6 +279,14 @@ wp_mail('foo@bar.com', 'Subject goes here', 'Message goes here', $email);
|
|
276 |
|
277 |
You can find more examples here: https://github.com/sendgrid/sendgrid-php/blob/v4.0.2/README.md
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
== Screenshots ==
|
280 |
|
281 |
1. Go to Admin Panel, section Plugins and activate the SendGrid plugin. If you want to send emails through SMTP you need to install also the 'Swift Mailer' plugin.
|
@@ -292,6 +303,9 @@ You can find more examples here: https://github.com/sendgrid/sendgrid-php/blob/v
|
|
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
|
@@ -472,6 +486,9 @@ You can find more examples here: https://github.com/sendgrid/sendgrid-php/blob/v
|
|
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
|
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.7
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
100 |
* Signup confirmation email content: define('SENDGRID_MC_SIGNUP_EMAIL_CONTENT', '<a href="%confirmation_link%">click here</a>');
|
101 |
* Signup confirmation page ID: define('SENDGRID_MC_SIGNUP_CONFIRMATION_PAGE', 'page_id');
|
102 |
|
103 |
+
4. Other configuration options:
|
104 |
+
* Set a custom timeout for API requests to SendGrid in seconds: define('SENDGRID_REQUEST_TIMEOUT', 10);
|
105 |
+
|
106 |
= Filters =
|
107 |
|
108 |
Use HTML content type for a single email:
|
279 |
|
280 |
You can find more examples here: https://github.com/sendgrid/sendgrid-php/blob/v4.0.2/README.md
|
281 |
|
282 |
+
= My server is slow. Can I increate the timeout for API requests? =
|
283 |
+
|
284 |
+
Yes. You can define a constant in your wp-config.php file like this:
|
285 |
+
|
286 |
+
`define('SENDGRID_REQUEST_TIMEOUT', 10);`
|
287 |
+
|
288 |
+
The value is in seconds, this means that API requests will wait 10 seconds for a reponse from the SendGrid API server until timing out.
|
289 |
+
|
290 |
== Screenshots ==
|
291 |
|
292 |
1. Go to Admin Panel, section Plugins and activate the SendGrid plugin. If you want to send emails through SMTP you need to install also the 'Swift Mailer' plugin.
|
303 |
|
304 |
== Changelog ==
|
305 |
|
306 |
+
= 1.11.7 =
|
307 |
+
* Added a configuration parameter of API request timeout in seconds
|
308 |
+
* Fixed an issue that made the HTML subscription emails break links
|
309 |
= 1.11.6 =
|
310 |
* Added a feature flag to disable whitespace normalization in BuddyPress plaintext emails
|
311 |
* Fixed an issue where the from name and email subjects would incorrectly display the ampersand symbol
|
486 |
|
487 |
== Upgrade notice ==
|
488 |
|
489 |
+
= 1.11.7 =
|
490 |
+
* Added a configuration parameter of API request timeout in seconds
|
491 |
+
* Fixed an issue that made the HTML subscription emails break links
|
492 |
= 1.11.6 =
|
493 |
* Added a feature flag to disable whitespace normalization in BuddyPress plaintext emails
|
494 |
* Fixed an issue where the from name and email subjects would incorrectly display the ampersand symbol
|
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.
|
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.7
|
7 |
Author: SendGrid
|
8 |
Author URI: http://sendgrid.com
|
9 |
Text Domain: sendgrid-email-delivery-simplified
|