Post SMTP Mailer/Email Log - Version 2.0.14

Version Description

Download this release

Release Info

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

Code changes from version 2.0.13 to 2.0.14

Postman/Phpmailer/PostsmtpMailer-old.php DELETED
@@ -1,159 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit; // Exit if accessed directly
4
- }
5
-
6
- if ( ! class_exists( 'PHPMailer', false ) ) {
7
- require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php';
8
- require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php';
9
- require_once ABSPATH . WPINC . '/PHPMailer/Exception.php';
10
- }
11
-
12
- use PHPMailer\PHPMailer\PHPMailer;
13
- use PHPMailer\PHPMailer\Exception;
14
-
15
- add_action('plugins_loaded', function() {
16
- global $phpmailer;
17
-
18
- $phpmailer = new PostsmtpMailer(true);
19
- });
20
-
21
- class PostsmtpMailer extends PHPMailer {
22
-
23
- private $mail_args = array();
24
-
25
- private $options;
26
-
27
- private $error;
28
-
29
- private $transcript = '';
30
-
31
- public function __construct($exceptions = null)
32
- {
33
- parent::__construct($exceptions);
34
-
35
- $this->set_vars();
36
- $this->hooks();
37
-
38
- }
39
-
40
- public function set_vars() {
41
- $this->options = PostmanOptions::getInstance();
42
- $this->Debugoutput = function($str, $level) {
43
- $this->transcript .= $str;
44
- };
45
- }
46
-
47
- public function hooks() {
48
- add_filter( 'wp_mail', array( $this, 'get_mail_args' ) );
49
- if ( $this->options->getTransportType() == 'smtp' ) {
50
- add_action( 'phpmailer_init', array( $this, 'phpmailer_smtp_init' ), 999 );
51
- }
52
- }
53
-
54
- public function get_mail_args( $atts ) {
55
- $this->mail_args = array();
56
- $this->mail_args[] = $atts['to'];
57
- $this->mail_args[] = $atts['subject'];
58
- $this->mail_args[] = $atts['message'];
59
- $this->mail_args[] = $atts['headers'];
60
- $this->mail_args[] = $atts['attachments'];
61
-
62
- return $atts;
63
- }
64
-
65
- /**
66
- * @param PHPMailer $mail
67
- */
68
- public function phpmailer_smtp_init($mail) {
69
- $mail->SMTPDebug = 3;
70
- $mail->isSMTP();
71
- $mail->Host = $this->options->getHostname();
72
-
73
- if ( $this->options->getAuthenticationType() !== 'none' ) {
74
- $mail->SMTPAuth = true;
75
- $mail->Username = $this->options->getUsername();
76
- $mail->Password = $this->options->getPassword();
77
- }
78
-
79
- if ( $this->options->getEncryptionType() !== 'none' ) {
80
- $mail->SMTPSecure = $this->options->getEncryptionType();
81
- }
82
-
83
- $mail->Port = $this->options->getPort();
84
-
85
- if ( $this->options->isPluginSenderEmailEnforced() ) {
86
- $mail->setFrom( $this->options->getMessageSenderEmail() , $this->options->getMessageSenderName () );
87
- }
88
- }
89
-
90
- public function send()
91
- {
92
- require_once dirname(__DIR__) . '/PostmanWpMail.php';
93
-
94
- // create a PostmanWpMail instance
95
- $postmanWpMail = new PostmanWpMail();
96
- $postmanWpMail->init();
97
-
98
- list($to, $subject, $body, $headers, $attachments) = array_pad( $this->mail_args, 5, null );
99
-
100
- // build the message
101
- $postmanMessage = $postmanWpMail->processWpMailCall( $to, $subject, $body, $headers, $attachments );
102
-
103
- // build the email log entry
104
- $log = new PostmanEmailLog();
105
- $log->originalTo = $to;
106
- $log->originalSubject = $subject;
107
- $log->originalMessage = $body;
108
- $log->originalHeaders = $headers;
109
-
110
- // get the transport and create the transportConfig and engine
111
- $transport = PostmanTransportRegistry::getInstance()->getActiveTransport();
112
-
113
- add_filter( 'postman_wp_mail_result', [ $this, 'postman_wp_mail_result' ] );
114
-
115
- try {
116
-
117
- if ( $send_email = apply_filters( 'post_smtp_do_send_email', true ) ) {
118
- $result = $this->options->getTransportType() !== 'smtp' ?
119
- $postmanWpMail->send( $to, $subject, $body, $headers, $attachments ) :
120
- $this->sendSmtp();
121
- }
122
-
123
-
124
- do_action( 'post_smtp_on_success', $log, $postmanMessage, $this->transcript, $transport );
125
-
126
- return $result;
127
-
128
- } catch (Exception $exc) {
129
-
130
- $this->error = $exc;
131
-
132
- $this->mailHeader = '';
133
-
134
- $this->setError($exc->getMessage());
135
- if ($this->exceptions) {
136
- throw $exc;
137
- }
138
- return false;
139
- }
140
-
141
- }
142
-
143
- public function sendSmtp() {
144
- if (!$this->preSend()) {
145
- return false;
146
- }
147
- return $this->postSend();
148
- }
149
-
150
-
151
- public function postman_wp_mail_result() {
152
- $result = [
153
- 'time' => '',
154
- 'exception' => $this->error,
155
- 'transcript' => $this->transcript,
156
- ];
157
- return $result;
158
- }
159
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
postman-smtp.php CHANGED
@@ -6,7 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) {
6
  * Plugin Name: Post SMTP
7
  * Plugin URI: https://wordpress.org/plugins/post-smtp/
8
  * 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!
9
- * Version: 2.0.13
10
  * Author: Yehuda Hassine
11
  * Text Domain: post-smtp
12
  * Author URI: https://postmansmtp.com
@@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) {
35
  define( 'POST_SMTP_BASE', __FILE__ );
36
  define( 'POST_SMTP_PATH', __DIR__ );
37
  define( 'POST_SMTP_URL', plugins_url('', POST_SMTP_BASE ) );
38
- define( 'POST_SMTP_VER', '2.0.13' );
39
  define( 'POST_SMTP_SHOW_RELEASE_MESSAGE', true );
40
  define( 'POST_SMTP_RELEASE_MESSAGE', "I have released a new Google Analytics AIO plugin, if you liked it please leave a review." );
41
  define( 'POST_SMTP_RELEASE_URL', 'https://wordpress.org/plugins/metrics-query/' );
6
  * Plugin Name: Post SMTP
7
  * Plugin URI: https://wordpress.org/plugins/post-smtp/
8
  * 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!
9
+ * Version: 2.0.14
10
  * Author: Yehuda Hassine
11
  * Text Domain: post-smtp
12
  * Author URI: https://postmansmtp.com
35
  define( 'POST_SMTP_BASE', __FILE__ );
36
  define( 'POST_SMTP_PATH', __DIR__ );
37
  define( 'POST_SMTP_URL', plugins_url('', POST_SMTP_BASE ) );
38
+ define( 'POST_SMTP_VER', '2.0.14' );
39
  define( 'POST_SMTP_SHOW_RELEASE_MESSAGE', true );
40
  define( 'POST_SMTP_RELEASE_MESSAGE', "I have released a new Google Analytics AIO plugin, if you liked it please leave a review." );
41
  define( 'POST_SMTP_RELEASE_URL', 'https://wordpress.org/plugins/metrics-query/' );
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: 5.5
7
- Stable tag: 2.0.13
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
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: 5.5
7
+ Stable tag: 2.0.14
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10