SendGrid - Version 1.6.8

Version Description

  • Update api_key validation
Download this release

Release Info

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

Code changes from version 1.6.7 to 1.6.8

lib/class-sendgrid-settings.php CHANGED
@@ -81,7 +81,7 @@ class Sendgrid_Settings
81
  $status = 'error';
82
  } else {
83
  if ( ! Sendgrid_Tools::check_api_key( $_POST['sendgrid_api_key'] ) ) {
84
- $message = 'Invalid api key';
85
  $status = 'error';
86
  }
87
  }
81
  $status = 'error';
82
  } else {
83
  if ( ! Sendgrid_Tools::check_api_key( $_POST['sendgrid_api_key'] ) ) {
84
+ $message = 'Invalid or without permissions api key';
85
  $status = 'error';
86
  }
87
  }
lib/class-sendgrid-tools.php CHANGED
@@ -39,7 +39,7 @@ class Sendgrid_Tools
39
  */
40
  public static function check_api_key( $api_key )
41
  {
42
- $url = 'https://api.sendgrid.com/v3/user/profile';
43
 
44
  $args = array(
45
  'headers' => array(
@@ -54,7 +54,9 @@ class Sendgrid_Tools
54
 
55
  $response = json_decode( $response['body'], true );
56
 
57
- if ( isset( $response['errors'] ) ) {
 
 
58
  return false;
59
  }
60
 
39
  */
40
  public static function check_api_key( $api_key )
41
  {
42
+ $url = 'https://api.sendgrid.com/api/mail.send.json';
43
 
44
  $args = array(
45
  'headers' => array(
54
 
55
  $response = json_decode( $response['body'], true );
56
 
57
+ if ( isset( $response['errors'] ) and
58
+ ( ( 'Authenticated user is not authorized to send mail' == $response['errors'][0] ) or
59
+ ( 'The provided authorization grant is invalid, expired, or revoked' == $response['errors'][0] ) ) ) {
60
  return false;
61
  }
62
 
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.3
7
- Stable tag: 1.6.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -96,7 +96,7 @@ To auto install the SendGrid Plugin from the WordPress admin:
96
 
97
  SendGrid settings can optionally be defined as global variables (wp-config.php):
98
 
99
- 1. Set credentials (You can use credentials or Api key. If using credentials, both need to be set in order to get credentials from variables and not from the database):
100
  * Username: define('SENDGRID_USERNAME', 'sendgrid_username');
101
  * Password: define('SENDGRID_PASSWORD', 'sendgrid_password');
102
  * API key: define('SENDGRID_API_KEY', 'sendgrid_api_key');
@@ -130,6 +130,8 @@ Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" tar
130
 
131
  == Changelog ==
132
 
 
 
133
  = 1.6.7 =
134
  * Ability to use email templates, fix category statistics, display sender test form if we only have sending errors
135
  = 1.6.6 =
@@ -193,6 +195,8 @@ Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" tar
193
 
194
  == Upgrade notice ==
195
 
 
 
196
  = 1.6.7 =
197
  * Ability to use email templates, fix category statistics, display sender test form if we only have sending errors
198
  = 1.6.6 =
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.3
7
+ Stable tag: 1.6.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
96
 
97
  SendGrid settings can optionally be defined as global variables (wp-config.php):
98
 
99
+ 1. Set credentials (You can use credentials or Api key. If using credentials, both need to be set in order to get credentials from variables and not from the database. If using API key you need to make sure you set the Mail Send and Stats permissions to FULL ACCESS when you created the api key on Sendgrid side, so you can send emails and see statistics on wordpress):
100
  * Username: define('SENDGRID_USERNAME', 'sendgrid_username');
101
  * Password: define('SENDGRID_PASSWORD', 'sendgrid_password');
102
  * API key: define('SENDGRID_API_KEY', 'sendgrid_api_key');
130
 
131
  == Changelog ==
132
 
133
+ = 1.6.8 =
134
+ * Update api_key validation
135
  = 1.6.7 =
136
  * Ability to use email templates, fix category statistics, display sender test form if we only have sending errors
137
  = 1.6.6 =
195
 
196
  == Upgrade notice ==
197
 
198
+ = 1.6.8 =
199
+ * Update api_key validation
200
  = 1.6.7 =
201
  * Ability to use email templates, fix category statistics, display sender test form if we only have sending errors
202
  = 1.6.6 =
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.6.7
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.6.8
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  Text Domain: sendgrid-email-delivery-simplified