PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 2.0.0
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v2.0.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 6 years ago src 6 years ago vendor 6 years ago readme.txt 6 years ago uninstall.php 6 years ago wp-mail-smtp.php 6 years ago wp_mail_smtp.php 6 years ago
wp_mail_smtp.php
228 lines
1 <?php
2 /**
3 * Plugin Name: WP Mail SMTP
4 * Version: 2.0.0
5 * Plugin URI: https://wpmailsmtp.com/
6 * 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.
7 * Author: WPForms
8 * Author URI: https://wpforms.com/
9 * Network: false
10 * Text Domain: wp-mail-smtp
11 * Domain Path: /assets/languages
12 */
13
14 /**
15 * @author WPForms
16 * @copyright WPForms, 2007-20, All Rights Reserved
17 * This code is released under the GPL licence version 3 or later, available here
18 * https://www.gnu.org/licenses/gpl.txt
19 */
20
21 /**
22 * Setting options in wp-config.php
23 *
24 * Specifically aimed at WP Multisite users, you can set the options for this plugin as
25 * constants in wp-config.php. Copy the code below into wp-config.php and tweak settings.
26 * Values from constants are NOT stripslash()'ed.
27 *
28 * When enabled, make sure to comment out (at the beginning of the line using //) those constants that you do not need,
29 * or remove them completely, so they won't interfere with plugin settings.
30 */
31
32 /*
33 define( 'WPMS_ON', true ); // True turns on the whole constants support and usage, false turns it off.
34
35 define( 'WPMS_DO_NOT_SEND', true ); // Or false, in that case constant is ignored.
36
37 define( 'WPMS_MAIL_FROM', 'mail@example.com' );
38 define( 'WPMS_MAIL_FROM_FORCE', true ); // True turns it on, false turns it off.
39 define( 'WPMS_MAIL_FROM_NAME', 'From Name' );
40 define( 'WPMS_MAIL_FROM_NAME_FORCE', true ); // True turns it on, false turns it off.
41 define( 'WPMS_MAILER', 'sendinblue' ); // Possible values: 'mail', 'smtpcom', 'sendinblue', 'mailgun', 'sendgrid', 'gmail', 'smtp'.
42 define( 'WPMS_SET_RETURN_PATH', true ); // Sets $phpmailer->Sender if true, relevant only for Other SMTP mailer.
43
44 // Recommended mailers.
45 define( 'WPMS_SMTPCOM_API_KEY', '' );
46 define( 'WPMS_SMTPCOM_CHANNEL', '' );
47
48 define( 'WPMS_PEPIPOST_API_KEY', '' );
49
50 define( 'WPMS_SENDINBLUE_API_KEY', '' );
51
52 define( 'WPMS_MAILGUN_API_KEY', '' );
53 define( 'WPMS_MAILGUN_DOMAIN', '' );
54 define( 'WPMS_MAILGUN_REGION', 'US' ); // or 'EU' for Europe.
55
56 define( 'WPMS_SENDGRID_API_KEY', '' );
57
58 define( 'WPMS_GMAIL_CLIENT_ID', '' );
59 define( 'WPMS_GMAIL_CLIENT_SECRET', '' );
60
61 define( 'WPMS_SMTP_HOST', 'localhost' ); // The SMTP mail host.
62 define( 'WPMS_SMTP_PORT', 25 ); // The SMTP server port number.
63 define( 'WPMS_SSL', '' ); // Possible values '', 'ssl', 'tls' - note TLS is not STARTTLS.
64 define( 'WPMS_SMTP_AUTH', true ); // True turns it on, false turns it off.
65 define( 'WPMS_SMTP_USER', 'username' ); // SMTP authentication username, only used if WPMS_SMTP_AUTH is true.
66 define( 'WPMS_SMTP_PASS', 'password' ); // SMTP authentication password, only used if WPMS_SMTP_AUTH is true.
67 define( 'WPMS_SMTP_AUTOTLS', true ); // True turns it on, false turns it off.
68 */
69
70 /**
71 * Don't allow multiple versions of 1.5.x (Lite and Pro) and above to be active.
72 *
73 * @since 1.5.0
74 */
75 if ( function_exists( 'wp_mail_smtp' ) ) {
76
77 if ( ! function_exists( 'wp_mail_smtp_deactivate' ) ) {
78 /**
79 * Deactivate if plugin already activated.
80 * Needed when transitioning from 1.5+ Lite to Pro.
81 *
82 * @since 1.5.0
83 */
84 function wp_mail_smtp_deactivate() {
85
86 deactivate_plugins( plugin_basename( __FILE__ ) );
87 }
88 }
89 add_action( 'admin_init', 'wp_mail_smtp_deactivate' );
90
91 // Do not process the plugin code further.
92 return;
93 }
94
95 if ( ! function_exists( 'wp_mail_smtp_check_pro_loading_allowed' ) ) {
96 /**
97 * Don't allow 1.4.x and below to break when 1.5+ Pro is activated.
98 * This will stop the current plugin from loading and display a message in admin area.
99 *
100 * @since 1.5.0
101 */
102 function wp_mail_smtp_check_pro_loading_allowed() {
103
104 // Check for pro without using wp_mail_smtp()->is_pro(), because at this point it's too early.
105 if ( ! is_readable( rtrim( plugin_dir_path( __FILE__ ), '/\\' ) . '/src/Pro/Pro.php' ) ) {
106 // Currently, not a pro version of the plugin is loaded.
107 return false;
108 }
109
110 if ( ! function_exists( 'is_plugin_active' ) ) {
111 require_once ABSPATH . '/wp-admin/includes/plugin.php';
112 }
113
114 // Search for old plugin name.
115 if ( is_plugin_active( 'wp-mail-smtp/wp_mail_smtp.php' ) ) {
116 // As Pro is loaded and Lite too - deactivate *silently* itself not to break older SMTP plugin.
117 deactivate_plugins( plugin_basename( __FILE__ ) );
118
119 add_action( 'admin_notices', 'wp_mail_smtp_lite_deactivation_notice' );
120
121 return true;
122 }
123
124 return false;
125 }
126
127 if ( ! function_exists( 'wp_mail_smtp_lite_deactivation_notice' ) ) {
128 /**
129 * Display the notice after deactivation.
130 *
131 * @since 1.5.0
132 */
133 function wp_mail_smtp_lite_deactivation_notice() {
134
135 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>';
136
137 if ( isset( $_GET['activate'] ) ) { // phpcs:ignore
138 unset( $_GET['activate'] ); // phpcs:ignore
139 }
140 }
141 }
142
143 // Stop the plugin loading.
144 if ( wp_mail_smtp_check_pro_loading_allowed() === true ) {
145 return;
146 }
147 }
148
149 if ( ! function_exists( 'wp_mail_smtp_insecure_php_version_notice' ) ) {
150 /**
151 * Display admin notice, if the server is using old/insecure PHP version.
152 *
153 * @since 2.0.0
154 */
155 function wp_mail_smtp_insecure_php_version_notice() {
156
157 ?>
158 <div class="notice notice-error">
159 <p>
160 <?php
161 printf(
162 wp_kses( /* translators: %1$s - WPBeginner URL for recommended WordPress hosting. */
163 __( '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' ),
164 array(
165 'a' => array(
166 'href' => array(),
167 'target' => array(),
168 'rel' => array(),
169 ),
170 'strong' => array(),
171 )
172 ),
173 'https://www.wpbeginner.com/wordpress-hosting/'
174 );
175 ?>
176 <br><br>
177 <?php
178 printf(
179 wp_kses( /* translators: %s - WPMailSMTP.com docs URL with more details. */
180 __( '<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' ),
181 array(
182 'a' => array(
183 'href' => array(),
184 'target' => array(),
185 'rel' => array(),
186 ),
187 'strong' => array(),
188 )
189 ),
190 'https://wpmailsmtp.com/docs/supported-php-versions-for-wp-mail-smtp/'
191 );
192 ?>
193 </p>
194 </div>
195
196 <?php
197
198 // In case this is on plugin activation.
199 if ( isset( $_GET['activate'] ) ) { //phpcs:ignore
200 unset( $_GET['activate'] ); //phpcs:ignore
201 }
202 }
203 }
204
205 if ( ! defined( 'WPMS_PLUGIN_VER' ) ) {
206 define( 'WPMS_PLUGIN_VER', '2.0.0' );
207 }
208 if ( ! defined( 'WPMS_PHP_VER' ) ) {
209 define( 'WPMS_PHP_VER', '5.5.0' );
210 }
211 if ( ! defined( 'WPMS_PLUGIN_FILE' ) ) {
212 define( 'WPMS_PLUGIN_FILE', __FILE__ );
213 }
214
215 /**
216 * Display admin notice and prevent plugin code execution, if the server is
217 * using old/insecure PHP version.
218 *
219 * @since 2.0.0
220 */
221 if ( version_compare( phpversion(), WPMS_PHP_VER, '<' ) ) {
222 add_action( 'admin_notices', 'wp_mail_smtp_insecure_php_version_notice' );
223
224 return;
225 }
226
227 require_once dirname( __FILE__ ) . '/wp-mail-smtp.php';
228