SendGrid - Version 1.9.1

Version Description

  • Added filters that allow the change of text or HTML content of all emails before they are sent
  • Fixed an issue with the widget admin notice
Download this release

Release Info

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

Code changes from version 1.9.0 to 1.9.1

assets/screenshot-10.png CHANGED
Binary file
assets/screenshot-11.png CHANGED
Binary file
assets/screenshot-12.png CHANGED
Binary file
assets/screenshot-3.png CHANGED
Binary file
assets/screenshot-4.png CHANGED
Binary file
assets/screenshot-9.png CHANGED
Binary file
lib/class-sendgrid-tools.php CHANGED
@@ -970,6 +970,10 @@ function unregister_sendgrid_widgets() {
970
  * @return void
971
  */
972
  function sg_subscription_widget_admin_notice() {
 
 
 
 
973
  echo '<div class="notice notice-success">';
974
  echo '<p>';
975
  echo _e( 'Check out the new SendGrid Subscription Widget! See the SendGrid Plugin settings page in order to configure it.' );
970
  * @return void
971
  */
972
  function sg_subscription_widget_admin_notice() {
973
+ if( ! current_user_can('manage_options') ) {
974
+ return;
975
+ }
976
+
977
  echo '<div class="notice notice-success">';
978
  echo '<p>';
979
  echo _e( 'Check out the new SendGrid Subscription Widget! See the SendGrid Plugin settings page in order to configure it.' );
lib/sendgrid/sendgrid-wp-mail.php CHANGED
@@ -318,7 +318,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
318
  }
319
  }
320
 
321
- if( ! array_key_exists( 'sendgrid_override_template' , $GLOBALS['wp_filter'] ) ) {
322
  $template = Sendgrid_Tools::get_template();
323
  if ( $template ) {
324
  $mail->setTemplateId( $template );
@@ -329,8 +329,13 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
329
 
330
  $content_type = apply_filters( 'wp_mail_content_type', $content_type );
331
 
 
 
 
 
 
332
  $mail->setSubject( $subject )
333
- ->setText( $message )
334
  ->addCategory( SENDGRID_CATEGORY )
335
  ->setFrom( $from_email );
336
 
@@ -347,7 +352,13 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
347
 
348
  // send HTML content
349
  if ( 'text/plain' !== $content_type ) {
350
- $mail->setHtml( Sendgrid_Tools::remove_all_tag_urls( $message ) );
 
 
 
 
 
 
351
  }
352
 
353
  // set from name
@@ -387,11 +398,11 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
387
  return false;
388
  }
389
 
390
- return $sendgrid->send($mail);
391
  }
392
 
393
 
394
- if ( ! function_exists('set_html_content_type') )
395
  {
396
  /**
397
  * Return the content type used to send html emails
318
  }
319
  }
320
 
321
+ if ( ! array_key_exists( 'sendgrid_override_template', $GLOBALS['wp_filter'] ) ) {
322
  $template = Sendgrid_Tools::get_template();
323
  if ( $template ) {
324
  $mail->setTemplateId( $template );
329
 
330
  $content_type = apply_filters( 'wp_mail_content_type', $content_type );
331
 
332
+ $text_content = $message;
333
+ if ( array_key_exists( 'sendgrid_mail_text' , $GLOBALS['wp_filter'] ) ) {
334
+ $text_content = apply_filters( 'sendgrid_mail_text', $text_content );
335
+ }
336
+
337
  $mail->setSubject( $subject )
338
+ ->setText( $text_content )
339
  ->addCategory( SENDGRID_CATEGORY )
340
  ->setFrom( $from_email );
341
 
352
 
353
  // send HTML content
354
  if ( 'text/plain' !== $content_type ) {
355
+ $html_content = Sendgrid_Tools::remove_all_tag_urls( $message );
356
+
357
+ if ( array_key_exists( 'sendgrid_mail_html' , $GLOBALS['wp_filter'] ) ) {
358
+ $html_content = apply_filters( 'sendgrid_mail_html', $html_content );
359
+ }
360
+
361
+ $mail->setHtml( $html_content );
362
  }
363
 
364
  // set from name
398
  return false;
399
  }
400
 
401
+ return $sendgrid->send( $mail );
402
  }
403
 
404
 
405
+ if ( ! function_exists( 'set_html_content_type' ) )
406
  {
407
  /**
408
  * Return the content type used to send html emails
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.2
6
  Tested up to: 4.5
7
- Stable tag: 1.9.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,145 +12,29 @@ Send emails and upload contacts through SendGrid from your WordPress installatio
12
 
13
  == Description ==
14
 
15
- 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.
16
 
17
- The SendGrid plugin uses SMTP or API integration to send outgoing emails from your WordPress installation. It replaces the wp_mail function included with WordPress. It also offers the possibility to upload contacts to your SendGrid account for marketing emails through a subscription widget.
18
 
19
- In order to send emails through SMTP you need to install the 'Swift Mailer' plugin.
20
 
21
- To get the SendGrid plugin running after you have activated it, go to the plugin's settings page and set the SendGrid credentials, then choose how your email will be sent - either through SMTP or API.
22
 
23
- You can also set default values for the "Name", "Sending Address" and the "Reply Address", so that you don't need to set these headers every time you want to send an email from your application.
24
-
25
- You can set the template ID to be used in all your emails on the settings page or you can set it for each email in the headers.
26
-
27
- You can have an individual email sent to each recipient by setting x-smtpapi-to in headers: `'x-smtpapi-to: address1@sendgrid.com,address2@sendgrid.com'`. Note: when using SMTP method you need to have also the `to` address set (this may be dummy data since will be overwritten with the addresses from x-smtpapi-to) in order to be able to send emails.
28
-
29
- Emails are tracked and automatically tagged for statistics within the SendGrid Dashboard. You can also add general tags to every email sent, as well as particular tags based on selected emails defined by your requirements.
30
-
31
- There are a couple levels of integration between your WordPress installation and the SendGrid plugin:
32
-
33
- * The simplest option is to Install it, Configure it, and the SendGrid plugin for WordPress will start sending your emails through SendGrid.
34
- * We amended wp_mail() function so all email sends from WordPress should go through SendGrid. The wp_mail function is sending text emails as default, but you have an option of sending an email with HTML content.
35
-
36
- How to use `wp_mail()` function:
37
-
38
- We amended `wp_mail()` function so all email sends from WordPress should go through SendGrid.
39
-
40
- You can send emails using the following function: `wp_mail($to, $subject, $message, $headers = '', $attachments = array())`
41
-
42
- Where:
43
-
44
- * `$to` - Array or comma-separated list of email addresses to send message.
45
- * `$subject` - Email subject
46
- * `$message` - Message contents
47
- * `$headers` - Array or SendGrid\Email() object. Optional.
48
- * `$attachments` - Array or "\n"/"," separated list of files to attach. Optional.
49
-
50
- The wp_mail function is sending text emails as default. If you want to send an email with HTML content you have to set the content type to 'text/html' running `add_filter('wp_mail_content_type', 'set_html_content_type');` function before to `wp_mail()` one.
51
-
52
- After wp_mail function you need to run the `remove_filter('wp_mail_content_type', 'set_html_content_type');` to remove the 'text/html' filter to avoid conflicts --http://core.trac.wordpress.org/ticket/23578
53
-
54
- Example about how to send an HTML email using different headers:
55
-
56
- Using array for $headers:
57
-
58
- `$subject = 'Test SendGrid plugin';
59
- $message = 'testing WordPress plugin';
60
- $to = array('address1@sendgrid.com', 'Address2 <address2@sendgrid.com>', 'address3@sendgrid.com');
61
-
62
- $headers = array();
63
- $headers[] = 'From: Me Myself <me@example.net>';
64
- $headers[] = 'Cc: address4@sendgrid.com';
65
- $headers[] = 'Bcc: address5@sendgrid.com';
66
- $headers[] = 'unique-args:customer=mycustomer;location=mylocation';
67
- $headers[] = 'categories: category1, category2';
68
- $headers[] = 'template: templateID';
69
- $headers[] = 'x-smtpapi-to: address1@sendgrid.com,address2@sendgrid.com';
70
-
71
- $attachments = array('/tmp/img1.jpg', '/tmp/img2.jpg');
72
-
73
- add_filter('wp_mail_content_type', 'set_html_content_type');
74
- $mail = wp_mail($to, $subject, $message, $headers, $attachments);
75
-
76
- remove_filter('wp_mail_content_type', 'set_html_content_type');`
77
-
78
-
79
- Using SendGrid\Email() for $headers:
80
-
81
- `$subject = 'Test SendGrid plugin';
82
- $message = 'testing WordPress plugin';
83
- $to = array('address1@sendgrid.com', 'Address2 <address2@sendgrid.com>', 'address3@sendgrid.com');
84
-
85
- $headers = new SendGrid\Email();
86
- $headers->setFromName("Me Myself")
87
- ->setFrom("me@example.net")
88
- ->setCc("address4@sendgrid.com")
89
- ->setBcc("address5@sendgrid.com")
90
- ->setUniqueArgs(array('customer' => 'mycustomer', 'location' => 'mylocation'))
91
- ->addCategory('category1')
92
- ->addCategory('category2')
93
- ->setTemplateId('templateID');
94
-
95
- $attachments = array('/tmp/img1.jpg', '/tmp/img2.jpg');
96
-
97
- add_filter('wp_mail_content_type', 'set_html_content_type');
98
- $mail = wp_mail($to, $subject, $message, $headers, $attachments);
99
-
100
- remove_filter('wp_mail_content_type', 'set_html_content_type');`
101
-
102
- = How to use Substitution and Sections =
103
-
104
- `$subject = 'Hey %name%, you work at %place%';
105
- $message = 'testing WordPress plugin';
106
- $to = array('address1@sendgrid.com');
107
-
108
- $headers = new SendGrid\Email();
109
- $headers
110
- ->addSmtpapiTo("john@somewhere.com")
111
- ->addSmtpapiTo("harry@somewhere.com")
112
- ->addSmtpapiTo("Bob@somewhere.com")
113
- ->addSubstitution("%name%", array("John", "Harry", "Bob"))
114
- ->addSubstitution("%place%", array("%office%", "%office%", "%home%"))
115
- ->addSection("%office%", "an office")
116
- ->addSection("%home%", "your house")
117
- ;
118
-
119
- $mail = wp_mail($to, $subject, $message, $headers);`
120
-
121
- More examples for using SendGrid SMTPAPI header: <https://github.com/sendgrid/sendgrid-php#smtpapi>
122
-
123
- = Using categories =
124
-
125
- Categories used for emails can be set:
126
-
127
- * globally, for all emails sent, by setting the 'Categories' field in the 'Mail settings' section
128
- * per email by adding the category in the headers array: `$headers[] = 'categories: category1, category2';`
129
-
130
- If you would like to configure categories for statistics, you can configure it by setting the 'Categories' field in the 'Statistics settings' section
131
 
132
  = The Subscription Widget =
133
 
134
- You can let your users subscribe to your marketing emails using the subscription widget. In order to set it up, go to the "Subscription Widget" tab on the plugin's settings page. You can use a separate API key for contact upload, other that what you set up for transactional emails. If you want to use the same credentials for contact upload as you do for sending emails just check the "Use same authentication as transactional" option.
135
-
136
- After you set up a valid API key you will be able to select the list where contacts will be uploaded. If you don't have a list set up, go to your SendGrid Dashboard -> Marketing -> Contacts and set one up.
137
-
138
- Once you have set up a valid authentication method and selected a valid list, a form to test the subscription will appear at the bottom of the page on the Subscription Widget settings tab. You can test the subscription process by entering an email address and clicking 'Test'.
139
-
140
- An email will be sent to that email address with a confirmation link. By clicking it, you will be redirected to your website and the email will be uploaded to your contacts on the SendGrid Dashboard. You can customize the subject and contents of the email in the settings page.
141
-
142
- In order to display the widget on your website, go to the widgets page and using drag and drop, add it to the section of your page where you want it displayed. You can configure the title and messages that are being displayed to the user. By default, only the email field is displayed and required. You can configure this in the plugin settings page, on the Subscription Widget tab, if you wish to also display the First Name and Last Name fields and whether they are required or not.
143
 
144
- You can also configure the page that will be displayed to the user by selecting it from the drop down menu on the settings page.
145
 
146
  == Installation ==
147
 
148
  Requirements:
149
 
150
  1. PHP version >= 5.3.0
151
- 2. You need to have PHP-curl extension enabled in order to send attachments.
152
- 3. To send emails through SMTP you need to install also the 'Swift Mailer' plugin.
153
- 4. If wp_mail() function has been declared by another plugin that you have installed, you won't be able to use the SendGrid plugin
154
 
155
  To upload the SendGrid Plugin .ZIP file:
156
 
@@ -167,6 +51,8 @@ To auto install the SendGrid Plugin from the WordPress admin:
167
  4. Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" target="_blank">http://sendgrid.com/partner/wordpress</a>
168
  5. Navigate to "Settings" -> "SendGrid Settings" and enter your SendGrid credentials
169
 
 
 
170
  SendGrid settings can optionally be defined as global variables (wp-config.php):
171
 
172
  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 permissions to FULL ACCESS, Stats to READ ACCESS and Template Engine to READ or FULL ACCESS when you created the api key on SendGrid side, so you can send emails and see statistics on wordpress):
@@ -194,8 +80,54 @@ SendGrid settings can optionally be defined as global variables (wp-config.php):
194
  * Signup confirmation email content: define('SENDGRID_MC_SIGNUP_EMAIL_CONTENT', '&lt;a href="%confirmation_link%"&gt;click here&lt;/a&gt;');
195
  * Signup confirmation page ID: define('SENDGRID_MC_SIGNUP_CONFIRMATION_PAGE', 'page_id');
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  == Frequently asked questions ==
198
 
 
 
 
 
199
  = What credentials do I need to add on settings page ? =
200
 
201
  Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" target="_blank">https://sendgrid.com/partner/wordpress</a> and generate a new API key on <https://app.sendgrid.com/settings/api_keys>.
@@ -222,7 +154,7 @@ add_filter( 'sendgrid_override_template', 'use_wpbe_template', 10, 2 );`
222
 
223
  Using the default templates from WP Better Emails will cause all emails to be sent as HTML (i.e. text/html content-type). In order to send emails as plain text (i.e. text/plain content-type) you should remove the HTML Template from WP Better Emails settings page. This is can be done by removing the '%content%' tag from the HTML template.
224
 
225
- = Why are my emails sent as HTML instead of plain text =
226
 
227
  For a detailed explanation see this page: https://support.sendgrid.com/hc/en-us/articles/200181418-Plain-text-emails-converted-to-HTML
228
 
@@ -235,10 +167,34 @@ The contacts will only be uploaded to Marketing Campaigns.
235
  For the API Key used for sending emails, that is entered on the General tab, the key needs to have Full Access to Mail Send and Read Access to Stats.
236
  For the API Key used for contact upload, that is entered on the Subscription Widget tab, the key needs to have Full Access to Marketings Campaigns.
237
 
238
- = Can I disable the opt-in email? =
239
 
240
  No. SendGrid’s Email Policy requires all email addressing being sent to by SendGrid customers be confirmed opt-in addresses.
241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  == Screenshots ==
243
 
244
  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.
@@ -249,13 +205,16 @@ No. SendGrid’s Email Policy requires all email addressing being sent to by Sen
249
  6. Header provided in the send test email form.
250
  7. If you click in the right corner from the top of the page on the "Help" button, a popup window with more information will appear.
251
  8. Select the time interval for which you want to see SendGrid statistics and charts.
252
- 9. Now you are able to configure port number when using SMTP method.
253
- 10. You are able to configure what template to use for sending emails.
254
- 11. You are able to configure categories for which you would like to see your stats.
255
- 12. You can use substitutions for emails.
256
 
257
  == Changelog ==
258
 
 
 
 
259
  = 1.9.0 =
260
  * Added the SendGrid Subscription Widget
261
  * The settings page now has tabs to separate the configuration of general settings from the widget settings
@@ -365,6 +324,9 @@ No. SendGrid’s Email Policy requires all email addressing being sent to by Sen
365
 
366
  == Upgrade notice ==
367
 
 
 
 
368
  = 1.9.0 =
369
  * Added the SendGrid Subscription Widget
370
  * The settings page now has tabs to separate the configuration of general settings from the widget settings
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.2
6
  Tested up to: 4.5
7
+ Stable tag: 1.9.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ What is the SendGrid WordPress Plugin?
16
 
17
+ SendGrid’s cloud-based email infrastructure relieves businesses of the cost and complexity of maintaining custom email systems. SendGrid provides reliable deliverability, scalability, and real-time analytics along with flexible APIs that make custom integration with your application a breeze.
18
 
19
+ SendGrid’s WordPress plugin replaces WordPress’s default wp_mail() function by using either an SMTP or API integration with SendGrid to send outgoing email from your WordPress installation. It also allows you to upload contacts directly to your SendGrid Marketing Campaigns account via a subscription widget.
20
 
21
+ By using the SendGrid plugin, you will be able to take advantage of improved deliverability and an expanded feature set, including tracking and analytics, to enhance user engagement on your WordPress installation. SendGrid also provides world class customer support, should you run into any issues.
22
 
23
+ For more details, consult our official documentation here : https://sendgrid.com/docs/Integrate/Tutorials/WordPress/index.html
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  = The Subscription Widget =
26
 
27
+ SendGrid’s WordPress Subscription Widget makes it easy for people visiting your WordPress site to subscribe to your marketing emails, such as any newsletters, announcements, or promotional offers you may send. Upon signup, they’ll automatically receive an opt-in email allowing them to confirm their desire to begin receiving your emails. This confirmation constitutes “double opt-in,” a deliverability best practice.
 
 
 
 
 
 
 
 
28
 
29
+ For more details, consult the official documentation for the Subscription Widget here : https://sendgrid.com/docs/Integrate/Tutorials/WordPress/subscription_widget.html
30
 
31
  == Installation ==
32
 
33
  Requirements:
34
 
35
  1. PHP version >= 5.3.0
36
+ 2. To send emails through SMTP you need to also install the 'Swift Mailer' plugin. ( https://wordpress.org/plugins/swift-mailer/ )
37
+ 3. If wp_mail() function has been declared by another plugin that you have installed, you won't be able to use the SendGrid plugin
 
38
 
39
  To upload the SendGrid Plugin .ZIP file:
40
 
51
  4. Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" target="_blank">http://sendgrid.com/partner/wordpress</a>
52
  5. Navigate to "Settings" -> "SendGrid Settings" and enter your SendGrid credentials
53
 
54
+ = Global Settings =
55
+
56
  SendGrid settings can optionally be defined as global variables (wp-config.php):
57
 
58
  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 permissions to FULL ACCESS, Stats to READ ACCESS and Template Engine to READ or FULL ACCESS when you created the api key on SendGrid side, so you can send emails and see statistics on wordpress):
80
  * Signup confirmation email content: define('SENDGRID_MC_SIGNUP_EMAIL_CONTENT', '&lt;a href="%confirmation_link%"&gt;click here&lt;/a&gt;');
81
  * Signup confirmation page ID: define('SENDGRID_MC_SIGNUP_CONFIRMATION_PAGE', 'page_id');
82
 
83
+ = Filters =
84
+
85
+ Use HTML content type for a single email:
86
+
87
+ `add_filter('wp_mail_content_type', 'set_html_content_type');
88
+
89
+ // Send the email
90
+
91
+ remove_filter('wp_mail_content_type', 'set_html_content_type');`
92
+
93
+ Change the email contents for all emails before they are sent:
94
+
95
+ `function change_content( $message, $content_type ) {
96
+ if ( 'text/plain' == $content_type ) {
97
+ $message = $message . ' will be sent as text ' ;
98
+ } else {
99
+ $message = $message . ' will be sent as text and HTML ';
100
+ }
101
+
102
+ return $message;
103
+ }
104
+
105
+ add_filter( 'sendgrid_override_template', 'change_content' );`
106
+
107
+ Changing the text content of all emails before they are sent:
108
+
109
+ `function change_sendgrid_text_email( $message ) {
110
+ return $message . ' changed by way of text filter ';
111
+ }
112
+
113
+ add_filter( 'sendgrid_mail_text', 'change_sendgrid_text_email' );`
114
+
115
+ Changing the HTML content of all emails before they are sent:
116
+
117
+ `function change_sendgrid_html_email( $message ) {
118
+ return $message . ' changed by way of html filter ';
119
+ }
120
+
121
+ add_filter( 'sendgrid_mail_html', 'change_sendgrid_html_email' );`
122
+
123
+ Note that all HTML emails sent through our plugin also contain the HTML body in the text part and that content will pass through the "sendgrid_mail_text" filter as well.
124
+
125
  == Frequently asked questions ==
126
 
127
+ = Is there any official documentation for this plugin ? =
128
+
129
+ Yes. You can find it here : https://sendgrid.com/docs/Integrate/Tutorials/WordPress/index.html
130
+
131
  = What credentials do I need to add on settings page ? =
132
 
133
  Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" target="_blank">https://sendgrid.com/partner/wordpress</a> and generate a new API key on <https://app.sendgrid.com/settings/api_keys>.
154
 
155
  Using the default templates from WP Better Emails will cause all emails to be sent as HTML (i.e. text/html content-type). In order to send emails as plain text (i.e. text/plain content-type) you should remove the HTML Template from WP Better Emails settings page. This is can be done by removing the '%content%' tag from the HTML template.
156
 
157
+ = Why are my emails sent as HTML instead of plain text ? =
158
 
159
  For a detailed explanation see this page: https://support.sendgrid.com/hc/en-us/articles/200181418-Plain-text-emails-converted-to-HTML
160
 
167
  For the API Key used for sending emails, that is entered on the General tab, the key needs to have Full Access to Mail Send and Read Access to Stats.
168
  For the API Key used for contact upload, that is entered on the Subscription Widget tab, the key needs to have Full Access to Marketings Campaigns.
169
 
170
+ = Can I disable the opt-in email ? =
171
 
172
  No. SendGrid’s Email Policy requires all email addressing being sent to by SendGrid customers be confirmed opt-in addresses.
173
 
174
+ = Can I change the content of the emails before they are sent ? =
175
+
176
+ Yes. You must add a filter that does that. You need to declare a function that takes the content of the email as argument and then call add_filter() with the name "sendgrid_mail_text" or "sendgrid_mail_html", depending on what part of the email you want to change.
177
+
178
+ If you want to change the text content of all the emails before they are sent you can do it like this :
179
+
180
+ `function change_sendgrid_text_email( $message ) {
181
+ return $message . ' changed by way of text filter ';
182
+ }
183
+
184
+ add_filter( 'sendgrid_mail_text', 'change_sendgrid_text_email' );`
185
+
186
+ If you want to change HTML content of all the emails before they are sent you can do it like this :
187
+
188
+ `function change_sendgrid_html_email( $message ) {
189
+ return $message . ' changed by way of html filter ';
190
+ }
191
+
192
+ add_filter( 'sendgrid_mail_html', 'change_sendgrid_html_email' );`
193
+
194
+ Note that what is changed depends of the content-type that you have set in the settings page or overwritten by way of filter. For "text/plain" only the text part is overwritten by the filter. For "text/html" both the text and the HTML filters are called.
195
+
196
+ The code snippets above are usually added in the functions.php file of your theme.
197
+
198
  == Screenshots ==
199
 
200
  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.
205
  6. Header provided in the send test email form.
206
  7. If you click in the right corner from the top of the page on the "Help" button, a popup window with more information will appear.
207
  8. Select the time interval for which you want to see SendGrid statistics and charts.
208
+ 9. You can configure the port number when using SMTP method.
209
+ 10. You can configure categories for which you would like to see your stats.
210
+ 11. You can use substitutions for emails using X-SMTPAPI headers.
211
+ 12. You can configure the subscription widget.
212
 
213
  == Changelog ==
214
 
215
+ = 1.9.1 =
216
+ * Added filters that allow the change of text or HTML content of all emails before they are sent
217
+ * Fixed an issue with the widget admin notice
218
  = 1.9.0 =
219
  * Added the SendGrid Subscription Widget
220
  * The settings page now has tabs to separate the configuration of general settings from the widget settings
324
 
325
  == Upgrade notice ==
326
 
327
+ = 1.9.1 =
328
+ * Added filters that allow the change of text or HTML content of all emails before they are sent
329
+ * Fixed an issue with the widget admin notice
330
  = 1.9.0 =
331
  * Added the SendGrid Subscription Widget
332
  * The settings page now has tabs to separate the configuration of general settings from the widget settings
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.9.0
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.9.1
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  Text Domain: sendgrid-email-delivery-simplified