Post SMTP Mailer/Email Log - Version 1.8.3

Version Description

  • 2018-03-21
  • Fix: SendGrid API Call Structure (The previous try didn't work)
Download this release

Release Info

Developer yehudah
Plugin Icon 128x128 Post SMTP Mailer/Email Log
Version 1.8.3
Comparing to
See all releases

Code changes from version 1.8.2 to 1.8.3

Postman/Postman-Email-Log/PostmanEmailLogService.php CHANGED
@@ -163,13 +163,13 @@ if ( ! class_exists( 'PostmanEmailLogService' ) ) {
163
$to_email = get_bloginfo( 'admin_email' );
164
$domain = get_bloginfo( 'url' );
165
if ( $log->statusMessage && ! empty( $log->statusMessage ) ) {
166
- mail( $to_email, "{$domain}: " . __( 'Post SMTP email error', Postman::TEXT_DOMAIN ), $message . $log->statusMessage, null, "-f{$to_email}" );
167
}
168
169
preg_match_all( '/(.*)From/s', $log->sessionTranscript, $matches );
170
171
if ( isset( $matches[1][0] ) && ! empty( $matches[1][0] ) && strpos( strtolower( $matches[1][0] ), 'error' ) !== false ) {
172
- mail( $to_email, "{$domain}: " . __( 'Post SMTP session transcript error', Postman::TEXT_DOMAIN ), $message . $log->sessionTranscript, null, "-f{$to_email}" );
173
}
174
}
175
163
$to_email = get_bloginfo( 'admin_email' );
164
$domain = get_bloginfo( 'url' );
165
if ( $log->statusMessage && ! empty( $log->statusMessage ) ) {
166
+ mail( $to_email, "{$domain}: " . __( 'Post SMTP email error', Postman::TEXT_DOMAIN ), $message . $log->statusMessage, '', "-f{$to_email}" );
167
}
168
169
preg_match_all( '/(.*)From/s', $log->sessionTranscript, $matches );
170
171
if ( isset( $matches[1][0] ) && ! empty( $matches[1][0] ) && strpos( strtolower( $matches[1][0] ), 'error' ) !== false ) {
172
+ mail( $to_email, "{$domain}: " . __( 'Post SMTP session transcript error', Postman::TEXT_DOMAIN ), $message . $log->sessionTranscript, '', "-f{$to_email}" );
173
}
174
}
175
Postman/Postman-Mail/PostmanSendGridMailEngine.php CHANGED
@@ -55,12 +55,24 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) {
55
// add the to recipients
56
$counter = 0;
57
$emails = array();
58
foreach ( ( array ) $message->getToRecipients() as $recipient ) {
59
$recipient->log( $this->logger, 'To' );
60
if ( $counter == 0 ) {
61
$to = new SendGrid\Email( $recipient->getName(), $recipient->getEmail() );
62
} else {
63
- $emails[] = new SendGrid\Email( $recipient->getName(), $recipient->getEmail() );
64
}
65
66
$counter++;
@@ -118,14 +130,20 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) {
118
119
// add the cc recipients
120
foreach ( ( array ) $message->getCcRecipients() as $recipient ) {
121
- $recipient->log( $this->logger, 'Cc' );
122
- $mail->personalization[0]->addCc( $recipient->getEmail(), $recipient->getName() );
123
}
124
125
// add the bcc recipients
126
foreach ( ( array ) $message->getBccRecipients() as $recipient ) {
127
- $recipient->log( $this->logger, 'Bcc' );
128
- $mail->personalization[0]->addBcc( $recipient->getEmail(), $recipient->getName() );
129
}
130
131
// add the messageId
@@ -163,7 +181,7 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) {
163
164
$response = $sendgrid->client->mail()->send()->post( $mail );
165
if ( $this->logger->isInfo() ) {
166
- $this->logger->info( );
167
}
168
169
$response_body = json_decode( $response->body() );
@@ -172,6 +190,9 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) {
172
$this->transcript = $response_body->errors[0]->message;
173
$this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
174
$this->transcript .= print_r( $mail, true );
175
throw new Exception( $response_body->errors[0]->message );
176
}
177
$this->transcript = print_r( $response->body(), true );
@@ -181,6 +202,7 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) {
181
$this->transcript = $e->getMessage();
182
$this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
183
$this->transcript .= print_r( $mail, true );
184
throw $e;
185
}
186
}
55
// add the to recipients
56
$counter = 0;
57
$emails = array();
58
+ /**
59
+ * @todo: Find a better approch.
60
+ */
61
+ $duplicates = array();
62
foreach ( ( array ) $message->getToRecipients() as $recipient ) {
63
$recipient->log( $this->logger, 'To' );
64
+
65
+ $email = $recipient->getEmail();
66
if ( $counter == 0 ) {
67
+ $this->logger->debug( 'Adding to=' . $recipient->getEmail() );
68
$to = new SendGrid\Email( $recipient->getName(), $recipient->getEmail() );
69
+ $duplicates[] = $email;
70
} else {
71
+ if ( ! in_array( $email, $duplicates ) ) {
72
+ $duplicates[] = $email;
73
+ $this->logger->debug( 'Adding personalization to=' . $recipient->getEmail() );
74
+ $emails[] = new SendGrid\Email( $recipient->getName(), $recipient->getEmail() );
75
+ }
76
}
77
78
$counter++;
130
131
// add the cc recipients
132
foreach ( ( array ) $message->getCcRecipients() as $recipient ) {
133
+ if ( ! in_array( $recipient->getEmail(), $duplicates ) ) {
134
+ $recipient->log( $this->logger, 'Cc' );
135
+ $email = new SendGrid\Email( $recipient->getName(), $recipient->getEmail() );
136
+ $mail->personalization[0]->addCc( $email );
137
+ }
138
}
139
140
// add the bcc recipients
141
foreach ( ( array ) $message->getBccRecipients() as $recipient ) {
142
+ if ( ! in_array( $recipient->getEmail(), $duplicates ) ) {
143
+ $recipient->log( $this->logger, 'Bcc' );
144
+ $email = new SendGrid\Email( $recipient->getName(), $recipient->getEmail() );
145
+ $mail->personalization[0]->addBcc( $email );
146
+ }
147
}
148
149
// add the messageId
181
182
$response = $sendgrid->client->mail()->send()->post( $mail );
183
if ( $this->logger->isInfo() ) {
184
+ $this->logger->info( sprintf( 'Message %d accepted for delivery', PostmanState::getInstance()->getSuccessfulDeliveries() + 1 ) );
185
}
186
187
$response_body = json_decode( $response->body() );
190
$this->transcript = $response_body->errors[0]->message;
191
$this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
192
$this->transcript .= print_r( $mail, true );
193
+
194
+ $this->logger->debug( 'Transcript=' . $this->transcript );
195
+
196
throw new Exception( $response_body->errors[0]->message );
197
}
198
$this->transcript = print_r( $response->body(), true );
202
$this->transcript = $e->getMessage();
203
$this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
204
$this->transcript .= print_r( $mail, true );
205
+ $this->logger->debug( 'Transcript=' . $this->transcript );
206
throw $e;
207
}
208
}
Postman/PostmanUtils.php CHANGED
@@ -432,25 +432,17 @@ class PostmanUtils {
432
}
433
434
public static function getServerName() {
435
- $ip = '';
436
-
437
- if ( strpos( $_SERVER['SERVER_SOFTWARE'], 'iis' ) !== false ) {
438
- $ip = $_SERVER['LOCAL_ADDR'];
439
- }
440
-
441
- if ( empty( $ip ) ) {
442
- $ip = $_SERVER['SERVER_ADDR'];
443
- }
444
-
445
- if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) {
446
- $host = gethostbyaddr( $ip );
447
- }
448
-
449
- if ( $host == $ip || $host == false ) {
450
- $host = filter_var( $_SERVER['HTTP_HOST'], FILTER_SANITIZE_STRING );
451
- }
452
-
453
- return $host ? $host : 'localhost';
454
}
455
456
public static function getHost( $url ) {
432
}
433
434
public static function getServerName() {
435
+ $result = 'localhost.localdomain';
436
+
437
+ if (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER)) {
438
+ $result = $_SERVER['SERVER_NAME'];
439
+ } elseif (function_exists('gethostname') and gethostname() !== false) {
440
+ $result = gethostname();
441
+ } elseif (php_uname('n') !== false) {
442
+ $result = php_uname('n');
443
+ }
444
+
445
+ return $result;
446
}
447
448
public static function getHost( $url ) {
postman-smtp.php CHANGED
@@ -4,7 +4,7 @@
4
* Plugin Name: Post SMTP
5
* Plugin URI: https://wordpress.org/plugins/post-smtp/
6
* Description: Email not reliable? Post SMTP is the first and only WordPress SMTP plugin to implement OAuth 2.0 for Gmail, Hotmail and Yahoo Mail. Setup is a breeze with the Configuration Wizard and integrated Port Tester. Enjoy worry-free delivery even if your password changes!
7
- * Version: 1.8.2
8
* Author: Jason Hendriks, Yehuda Hassine
9
* Text Domain: post-smtp
10
* Author URI: https://postmansmtp.com
@@ -71,5 +71,5 @@ function post_start( $startingMemory ) {
71
*/
72
function post_setupPostman() {
73
require_once 'Postman/Postman.php';
74
- $kevinCostner = new Postman( __FILE__, '1.8.2' );
75
}
4
* Plugin Name: Post SMTP
5
* Plugin URI: https://wordpress.org/plugins/post-smtp/
6
* Description: Email not reliable? Post SMTP is the first and only WordPress SMTP plugin to implement OAuth 2.0 for Gmail, Hotmail and Yahoo Mail. Setup is a breeze with the Configuration Wizard and integrated Port Tester. Enjoy worry-free delivery even if your password changes!
7
+ * Version: 1.8.3
8
* Author: Jason Hendriks, Yehuda Hassine
9
* Text Domain: post-smtp
10
* Author URI: https://postmansmtp.com
71
*/
72
function post_setupPostman() {
73
require_once 'Postman/Postman.php';
74
+ $kevinCostner = new Postman( __FILE__, '1.8.3' );
75
}
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@m
4
Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun
5
Requires at least: 3.9
6
Tested up to: 4.9.4
7
- Stable tag: 1.8.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -12,6 +12,10 @@ Send, log and troubleshoot your Outgoing Email easily. Supports everything: SMTP
12
13
== Description ==
14
15
= From now all the support is made on Post SMTP forums =
16
https://postmansmtp.com/forums/
17
@@ -23,7 +27,6 @@ See how fast and easy to setup Post SMTP with Google/Gsuite or any SMTP service.
23
24
https://www.youtube.com/watch?v=z-x1DhcAN0o
25
26
-
27
Post is a next-generation [SMTP Mailer](https://wordpress.org/plugins/search.php?q=smtp), software that assists in the delivery of email generated by your WordPress site. Post is the first and only plugin to support the [latest security standards](http://googleonlinesecurity.blogspot.ca/2014/04/new-security-measures-will-affect-older.html). With OAuth 2.0, there is **no need** to [store your email passsword](http://blog.codinghorror.com/youre-probably-storing-passwords-incorrectly/) in the WordPress database where it might be found.
28
29
The **Connectivity Test** and intelligent **Setup Wizard** scan your SMTP server to detect firewall blocks and eliminate configuration mistakes. The built-in **Email Log** is an invaluable resource for [diagnosing problems](https://wordpress.org/support/topic/ugly-e-mails-no-html-and-no-special-characters?replies=15) with emails. Even hosts that block the standard SMTP ports, like GoDaddy or Bluehost, can't stop your email as **Post can deliver via HTTPS** if it can't use SMTP.
@@ -38,20 +41,28 @@ Post is *not* another WP Mail SMTP clone like WP Bank or Easy SMTP. It replaces
38
* Supports forced recipients (cc, bcc, to) and custom email headers
39
* [SASL](https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer) Support: Plain/Login/CRAM-MD5/[XOAUTH2](https://en.wikipedia.org/wiki/OAuth#OAuth_2.0) authentication
40
* Security Support: [SMTPS](https://en.wikipedia.org/wiki/SMTPS) and [STARTTLS](https://en.wikipedia.org/wiki/STARTTLS) ([SSL/TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security))
41
- * Copy configuration to other instances of Post
42
43
= OAuth 2.0 Features =
44
* Supports the proprietary OAuth 2.0 implementations of Gmail, Hotmail and Yahoo
45
* Fire-and-forget delivery continues even if your password changes
46
* Gmail: By combining OAuth2 and the Gmail API, Post can deliver where other plugins can not
47
48
- = WebService (HTTPS) Email Features =
49
* Gmail API for sending Gmail and Google Apps email (requires a [Google](https://accounts.google.com/signup) account)
50
* Mandrill API for sending any email (requires a [Mandrill](http://www.mandrillapp.com) account)
51
- * COMING SOON: Sparkpost API for sending any email (requires a [Sparkpost](https://www.sparkpost.com) account)
52
* SendGrid API for sending any email (requires a [SendGrid](https://sendgrid.com) account and PHP 5.3)
53
54
- > Post needs [translators](https://translate.wordpress.org/projects/wp-plugins/post-smtp/stable)! If you are a non-English speaker, please get involved!
55
56
= Compatibile With.. =
57
* [Woocommerce](https://wordpress.org/plugins/woocommerce/)
@@ -77,7 +88,6 @@ Post is *not* another WP Mail SMTP clone like WP Bank or Easy SMTP. It replaces
77
* OAuth 2.0 features require a Gmail, Hotmail or Yahoo mail OAuth 2.0 credentials
78
79
80
-
81
== Installation ==
82
83
> To send email reliably, you must use the SMTP server assigned to that email. If Post is unable to connect to the right SMTP server, you may have to ask your host to open the ports, or create a new email account managed by your host, or switch hosts!
@@ -127,14 +137,6 @@ Post is *not* another WP Mail SMTP clone like WP Bank or Easy SMTP. It replaces
127
128
== Frequently Asked Questions ==
129
130
- = Where is Postman SMTP? =
131
- From 2015-11-08 more or less I can say that Jason the original author stoped maintain the plugin.
132
- He may still answered some support tickets, but nothing more.
133
-
134
- You can read more about the "story" here:
135
- https://postmansmtp.com/#story
136
-
137
-
138
= What is OAuth 2.0? =
139
140
A modern replacement for traditional password-based authentication. Post supports the OAuth 2.0 implementations of all three major e-mail providers: Gmail, Hotmail and Yahoo Mail.
@@ -198,7 +200,6 @@ https://vimeo.com/128589255
198
* If you have a Yahoo Account, from the [Yahoo Developer Network My Apps](https://developer.yahoo.com/apps/), select the Application and choose Delete App.
199
200
201
-
202
== Grant OAuth permission error messages ==
203
204
Please note that the Client ID and Client Secret fields are NOT for your username and password. They are for OAuth Credentials only.
@@ -263,7 +264,6 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a
263
264
265
266
-
267
== Screenshots ==
268
269
1. WordPress Dashboard showing both the Post widget and At a Glance widget
@@ -284,10 +284,13 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a
284
285
== Changelog ==
286
287
- = 1.8.2 - 2017-12-24
288
* Fix: SendGrid API Call Structure
289
290
- = 1.8.1 - 2017-12-24
291
* New: Sendgrid API & Client Version 6
292
* New: Add email log 'send to' column
293
* Fix: fallback emails on hosting require the '-f' parameter
4
Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun
5
Requires at least: 3.9
6
Tested up to: 4.9.4
7
+ Stable tag: 1.8.3
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
12
13
== Description ==
14
15
+ == Description ==
16
+
17
+ = WordPress Mail SMTP Plugin =
18
+
19
= From now all the support is made on Post SMTP forums =
20
https://postmansmtp.com/forums/
21
27
28
https://www.youtube.com/watch?v=z-x1DhcAN0o
29
30
Post is a next-generation [SMTP Mailer](https://wordpress.org/plugins/search.php?q=smtp), software that assists in the delivery of email generated by your WordPress site. Post is the first and only plugin to support the [latest security standards](http://googleonlinesecurity.blogspot.ca/2014/04/new-security-measures-will-affect-older.html). With OAuth 2.0, there is **no need** to [store your email passsword](http://blog.codinghorror.com/youre-probably-storing-passwords-incorrectly/) in the WordPress database where it might be found.
31
32
The **Connectivity Test** and intelligent **Setup Wizard** scan your SMTP server to detect firewall blocks and eliminate configuration mistakes. The built-in **Email Log** is an invaluable resource for [diagnosing problems](https://wordpress.org/support/topic/ugly-e-mails-no-html-and-no-special-characters?replies=15) with emails. Even hosts that block the standard SMTP ports, like GoDaddy or Bluehost, can't stop your email as **Post can deliver via HTTPS** if it can't use SMTP.
41
* Supports forced recipients (cc, bcc, to) and custom email headers
42
* [SASL](https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer) Support: Plain/Login/CRAM-MD5/[XOAUTH2](https://en.wikipedia.org/wiki/OAuth#OAuth_2.0) authentication
43
* Security Support: [SMTPS](https://en.wikipedia.org/wiki/SMTPS) and [STARTTLS](https://en.wikipedia.org/wiki/STARTTLS) ([SSL/TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security))
44
+ * Copy configuration to other instances of Post SMTP
45
46
= OAuth 2.0 Features =
47
* Supports the proprietary OAuth 2.0 implementations of Gmail, Hotmail and Yahoo
48
* Fire-and-forget delivery continues even if your password changes
49
* Gmail: By combining OAuth2 and the Gmail API, Post can deliver where other plugins can not
50
51
+ = API (HTTPS) Email Support =
52
* Gmail API for sending Gmail and Google Apps email (requires a [Google](https://accounts.google.com/signup) account)
53
+ Often bloggers and small business owners don't want to use third-party SMTP services. Well you can use your Gmail or G Suite account for SMTP emails.
54
+ <a href="https://www.cloudways.com/blog/post-smtp-mailer-fork-of-wordpress-postman-smtp-plugin/" rel="friend">Check the guide I wrote</a>
55
+
56
* Mandrill API for sending any email (requires a [Mandrill](http://www.mandrillapp.com) account)
57
+ Mandrill is an email infrastructure service offered as an add-on for MailChimp that you can use to send personalized, one-to-one e-commerce emails, or automated transactional emails.
58
+
59
+ * Mailgun API for sending any email (requires a [Mailgun](http://www.mailgun.com) account)
60
+ Mailgun SMTP is a popular SMTP service provider that allows you to send large quantities of emails. They allow you to send your first 10,000 emails for free every month.
61
+
62
* SendGrid API for sending any email (requires a [SendGrid](https://sendgrid.com) account and PHP 5.3)
63
+ SendGrid has a free SMTP plan that you can use to send up to 100 emails per day. With our native SendGrid SMTP integration, you can easily and securely set up SendGrid SMTP on your WordPress site.
64
65
+ > Post SMTP needs [translators](https://translate.wordpress.org/projects/wp-plugins/post-smtp/stable)! If you are a non-English speaker, please get involved!
66
67
= Compatibile With.. =
68
* [Woocommerce](https://wordpress.org/plugins/woocommerce/)
88
* OAuth 2.0 features require a Gmail, Hotmail or Yahoo mail OAuth 2.0 credentials
89
90
91
== Installation ==
92
93
> To send email reliably, you must use the SMTP server assigned to that email. If Post is unable to connect to the right SMTP server, you may have to ask your host to open the ports, or create a new email account managed by your host, or switch hosts!
137
138
== Frequently Asked Questions ==
139
140
= What is OAuth 2.0? =
141
142
A modern replacement for traditional password-based authentication. Post supports the OAuth 2.0 implementations of all three major e-mail providers: Gmail, Hotmail and Yahoo Mail.
200
* If you have a Yahoo Account, from the [Yahoo Developer Network My Apps](https://developer.yahoo.com/apps/), select the Application and choose Delete App.
201
202
203
== Grant OAuth permission error messages ==
204
205
Please note that the Client ID and Client Secret fields are NOT for your username and password. They are for OAuth Credentials only.
264
265
266
267
== Screenshots ==
268
269
1. WordPress Dashboard showing both the Post widget and At a Glance widget
284
285
== Changelog ==
286
287
+ = 1.8.3 - 2018-03-21
288
+ * Fix: SendGrid API Call Structure (The previous try didn't work)
289
+
290
+ = 1.8.2 - 2018-03-21
291
* Fix: SendGrid API Call Structure
292
293
+ = 1.8.1 - 2018-03-20
294
* New: Sendgrid API & Client Version 6
295
* New: Add email log 'send to' column
296
* Fix: fallback emails on hosting require the '-f' parameter