PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 3.2.0
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v3.2.0
0.9.6 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.2 1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 2.0.0 2.0.1 2.1.1 2.2.1 2.3.1 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 2.8.0 2.9.0 3.0.1 3.0.2 3.0.3 3.1.0 3.10.0 3.11.0 3.11.1 3.2.0 3.2.1 3.3.0 3.4.0 3.5.0 3.5.1 3.5.2 3.6.1 3.7.0 3.8.0 3.8.2 3.9.0 4.0.1 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.8.0 trunk 0.10.0 0.10.1 0.11.1 0.11.2 0.3.1 0.3.2 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.5.2 0.6 0.7 0.8 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5
wp-mail-smtp / wp_mail_smtp.php
wp-mail-smtp Last commit date
assets 4 years ago libs 4 years ago src 4 years ago vendor 4 years ago vendor_prefixed 4 years ago readme.txt 4 years ago uninstall.php 4 years ago wp-mail-smtp.php 4 years ago wp_mail_smtp.php 4 years ago
wp_mail_smtp.php
247 lines
1 <?php
2 /**
3 * Plugin Name: WP Mail SMTP
4 * Version: 3.2.0
5 * Requires at least: 4.9
6 * Requires PHP: 5.6.20
7 * Plugin URI: https://wpmailsmtp.com/
8 * Description: Reconfigures the <code>wp_mail()</code> function to use Gmail/Mailgun/SendGrid/SMTP instead of the default <code>mail()</code> and creates an options page to manage the settings.
9 * Author: WPForms
10 * Author URI: https://wpforms.com/
11 * Network: false
12 * Text Domain: wp-mail-smtp
13 * Domain Path: /assets/languages
14 */
15
16 /**
17 * @author WPForms
18 * @copyright WPForms, 2007-21, All Rights Reserved
19 * This code is released under the GPL licence version 3 or later, available here
20 * https://www.gnu.org/licenses/gpl.txt
21 */
22
23 /**
24 * Setting options in wp-config.php
25 *
26 * Specifically aimed at WP Multisite users, you can set the options for this plugin as
27 * constants in wp-config.php. Copy the code below into wp-config.php and tweak settings.
28 * Values from constants are NOT stripslash()'ed.
29 *
30 * When enabled, make sure to comment out (at the beginning of the line using //) those constants that you do not need,
31 * or remove them completely, so they won't interfere with plugin settings.
32 */
33
34 /*
35 define( 'WPMS_ON', true ); // True turns on the whole constants support and usage, false turns it off.
36
37 define( 'WPMS_DO_NOT_SEND', true ); // Or false, in that case constant is ignored.
38
39 define( 'WPMS_MAIL_FROM', 'mail@example.com' );
40 define( 'WPMS_MAIL_FROM_FORCE', true ); // True turns it on, false turns it off.
41 define( 'WPMS_MAIL_FROM_NAME', 'From Name' );
42 define( 'WPMS_MAIL_FROM_NAME_FORCE', true ); // True turns it on, false turns it off.
43 define( 'WPMS_MAILER', 'sendinblue' ); // Possible values: 'mail', 'smtpcom', 'sendinblue', 'mailgun', 'sendgrid', 'gmail', 'smtp'.
44 define( 'WPMS_SET_RETURN_PATH', true ); // Sets $phpmailer->Sender if true, relevant only for Other SMTP mailer.
45
46 // Recommended mailers.
47 define( 'WPMS_SMTPCOM_API_KEY', '' );
48 define( 'WPMS_SMTPCOM_CHANNEL', '' );
49 define( 'WPMS_SENDINBLUE_API_KEY', '' );
50 define( 'WPMS_SENDINBLUE_DOMAIN', '' );
51
52 define( 'WPMS_ZOHO_DOMAIN', '' );
53 define( 'WPMS_ZOHO_CLIENT_ID', '' );
54 define( 'WPMS_ZOHO_CLIENT_SECRET', '' );
55
56 define( 'WPMS_PEPIPOST_API_KEY', '' );
57
58 define( 'WPMS_SENDINBLUE_API_KEY', '' );
59
60 define( 'WPMS_MAILGUN_API_KEY', '' );
61 define( 'WPMS_MAILGUN_DOMAIN', '' );
62 define( 'WPMS_MAILGUN_REGION', 'US' ); // or 'EU' for Europe.
63
64 define( 'WPMS_SENDGRID_API_KEY', '' );
65
66 define( 'WPMS_GMAIL_CLIENT_ID', '' );
67 define( 'WPMS_GMAIL_CLIENT_SECRET', '' );
68
69 define( 'WPMS_SMTP_HOST', 'localhost' ); // The SMTP mail host.
70 define( 'WPMS_SMTP_PORT', 25 ); // The SMTP server port number.
71 define( 'WPMS_SSL', '' ); // Possible values '', 'ssl', 'tls' - note TLS is not STARTTLS.
72 define( 'WPMS_SMTP_AUTH', true ); // True turns it on, false turns it off.
73 define( 'WPMS_SMTP_USER', 'username' ); // SMTP authentication username, only used if WPMS_SMTP_AUTH is true.
74 define( 'WPMS_SMTP_PASS', 'password' ); // SMTP authentication password, only used if WPMS_SMTP_AUTH is true.
75 define( 'WPMS_SMTP_AUTOTLS', true ); // True turns it on, false turns it off.
76 */
77
78 /**
79 * Don't allow multiple versions of 1.5.x (Lite and Pro) and above to be active.
80 *
81 * @since 1.5.0
82 */
83 if ( function_exists( 'wp_mail_smtp' ) ) {
84
85 if ( ! function_exists( 'wp_mail_smtp_deactivate' ) ) {
86 /**
87 * Deactivate if plugin already activated.
88 * Needed when transitioning from 1.5+ Lite to Pro.
89 *
90 * @since 1.5.0
91 */
92 function wp_mail_smtp_deactivate() {
93 /*
94 * Prevent issues of WP functions not being available for other plugins that hook into
95 * this early deactivation. GH issue #861.
96 */
97 require_once ABSPATH . WPINC . '/pluggable.php';
98
99 deactivate_plugins( plugin_basename( __FILE__ ) );
100 }
101 }
102 add_action( 'admin_init', 'wp_mail_smtp_deactivate' );
103
104 // Do not process the plugin code further.
105 return;
106 }
107
108 if ( ! function_exists( 'wp_mail_smtp_check_pro_loading_allowed' ) ) {
109 /**
110 * Don't allow 1.4.x and below to break when 1.5+ Pro is activated.
111 * This will stop the current plugin from loading and display a message in admin area.
112 *
113 * @since 1.5.0
114 */
115 function wp_mail_smtp_check_pro_loading_allowed() {
116
117 // Check for pro without using wp_mail_smtp()->is_pro(), because at this point it's too early.
118 if ( ! is_readable( rtrim( plugin_dir_path( __FILE__ ), '/\\' ) . '/src/Pro/Pro.php' ) ) {
119 // Currently, not a pro version of the plugin is loaded.
120 return false;
121 }
122
123 if ( ! function_exists( 'is_plugin_active' ) ) {
124 require_once ABSPATH . '/wp-admin/includes/plugin.php';
125 }
126
127 // Search for old plugin name.
128 if ( is_plugin_active( 'wp-mail-smtp/wp_mail_smtp.php' ) ) {
129 /*
130 * Prevent issues of WP functions not being available for other plugins that hook into
131 * this early deactivation. GH issue #861.
132 */
133 require_once ABSPATH . WPINC . '/pluggable.php';
134
135 // As Pro is loaded and Lite too - deactivate *silently* itself not to break older SMTP plugin.
136 deactivate_plugins( plugin_basename( __FILE__ ) );
137
138 add_action( 'admin_notices', 'wp_mail_smtp_lite_deactivation_notice' );
139
140 return true;
141 }
142
143 return false;
144 }
145
146 if ( ! function_exists( 'wp_mail_smtp_lite_deactivation_notice' ) ) {
147 /**
148 * Display the notice after deactivation.
149 *
150 * @since 1.5.0
151 */
152 function wp_mail_smtp_lite_deactivation_notice() {
153
154 echo '<div class="notice notice-warning"><p>' . esc_html__( 'Please deactivate the free version of the WP Mail SMTP plugin before activating WP Mail SMTP Pro.', 'wp-mail-smtp' ) . '</p></div>';
155
156 if ( isset( $_GET['activate'] ) ) { // phpcs:ignore
157 unset( $_GET['activate'] ); // phpcs:ignore
158 }
159 }
160 }
161
162 // Stop the plugin loading.
163 if ( wp_mail_smtp_check_pro_loading_allowed() === true ) {
164 return;
165 }
166 }
167
168 if ( ! function_exists( 'wp_mail_smtp_insecure_php_version_notice' ) ) {
169 /**
170 * Display admin notice, if the server is using old/insecure PHP version.
171 *
172 * @since 2.0.0
173 */
174 function wp_mail_smtp_insecure_php_version_notice() {
175
176 ?>
177 <div class="notice notice-error">
178 <p>
179 <?php
180 printf(
181 wp_kses( /* translators: %1$s - WPBeginner URL for recommended WordPress hosting. */
182 __( 'Your site is running an <strong>insecure version</strong> of PHP that is no longer supported. Please contact your web hosting provider to update your PHP version or switch to a <a href="%1$s" target="_blank" rel="noopener noreferrer">recommended WordPress hosting company</a>.', 'wp-mail-smtp' ),
183 array(
184 'a' => array(
185 'href' => array(),
186 'target' => array(),
187 'rel' => array(),
188 ),
189 'strong' => array(),
190 )
191 ),
192 'https://www.wpbeginner.com/wordpress-hosting/'
193 );
194 ?>
195 <br><br>
196 <?php
197 printf(
198 wp_kses( /* translators: %s - WPMailSMTP.com docs URL with more details. */
199 __( '<strong>WP Mail SMTP plugin is disabled</strong> on your site until you fix the issue. <a href="%s" target="_blank" rel="noopener noreferrer">Read more for additional information.</a>', 'wp-mail-smtp' ),
200 array(
201 'a' => array(
202 'href' => array(),
203 'target' => array(),
204 'rel' => array(),
205 ),
206 'strong' => array(),
207 )
208 ),
209 'https://wpmailsmtp.com/docs/supported-php-versions-for-wp-mail-smtp/'
210 );
211 ?>
212 </p>
213 </div>
214
215 <?php
216
217 // In case this is on plugin activation.
218 if ( isset( $_GET['activate'] ) ) { //phpcs:ignore
219 unset( $_GET['activate'] ); //phpcs:ignore
220 }
221 }
222 }
223
224 if ( ! defined( 'WPMS_PLUGIN_VER' ) ) {
225 define( 'WPMS_PLUGIN_VER', '3.2.0' );
226 }
227 if ( ! defined( 'WPMS_PHP_VER' ) ) {
228 define( 'WPMS_PHP_VER', '5.6.20' );
229 }
230 if ( ! defined( 'WPMS_PLUGIN_FILE' ) ) {
231 define( 'WPMS_PLUGIN_FILE', __FILE__ );
232 }
233
234 /**
235 * Display admin notice and prevent plugin code execution, if the server is
236 * using old/insecure PHP version.
237 *
238 * @since 2.0.0
239 */
240 if ( version_compare( phpversion(), WPMS_PHP_VER, '<' ) ) {
241 add_action( 'admin_notices', 'wp_mail_smtp_insecure_php_version_notice' );
242
243 return;
244 }
245
246 require_once dirname( __FILE__ ) . '/wp-mail-smtp.php';
247