Version Description
- 2017-12-21 =
- Fixed: Decrease the factual minimum WordPress version from 3.9 to 3.6.
- Changed: Improve debug output for all mail providers.
Download this release
Release Info
Developer | slaFFik |
Plugin | ![]() |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.2.0
- languages/wp-mail-smtp.pot +43 -47
- readme.txt +336 -332
- src/Admin/Pages/Auth.php +4 -1
- src/Admin/Pages/Settings.php +18 -4
- src/Admin/Pages/Test.php +33 -50
- src/Core.php +1 -1
- src/Debug.php +118 -0
- src/Providers/Gmail/Auth.php +10 -3
- src/Providers/Gmail/Mailer.php +42 -55
- src/Providers/Gmail/Options.php +2 -2
- src/Providers/Loader.php +9 -5
- src/Providers/Mail/Mailer.php +32 -0
- src/Providers/Mail/Options.php +2 -2
- src/Providers/MailerAbstract.php +60 -4
- src/Providers/MailerInterface.php +14 -79
- src/Providers/Mailgun/Mailer.php +40 -1
- src/Providers/Mailgun/Options.php +2 -2
- src/Providers/{OptionAbstract.php → OptionsAbstract.php} +1 -1
- src/Providers/{OptionInterface.php → OptionsInterface.php} +1 -1
- src/Providers/Pepipost/Mailer.php +15 -0
- src/Providers/Pepipost/Options.php +3 -3
- src/Providers/SMTP/Mailer.php +15 -0
- src/Providers/SMTP/Options.php +2 -2
- src/Providers/Sendgrid/Mailer.php +53 -3
- src/Providers/Sendgrid/Options.php +2 -2
- wp-mail-smtp.php +20 -1
- wp_mail_smtp.php +856 -856
languages/wp-mail-smtp.pot
CHANGED
@@ -46,7 +46,7 @@ msgstr ""
|
|
46 |
msgid "WP Mail SMTP Settings"
|
47 |
msgstr ""
|
48 |
|
49 |
-
#: wp_mail_smtp.php:296, src/Admin/Pages/Settings.php:
|
50 |
msgid "From Email"
|
51 |
msgstr ""
|
52 |
|
@@ -58,7 +58,7 @@ msgstr ""
|
|
58 |
msgid "<strong>Please Note:</strong> You appear to be using a version of WordPress prior to 2.3. Please ignore the From Name field and instead enter Name<email@domain.com> in this field."
|
59 |
msgstr ""
|
60 |
|
61 |
-
#: wp_mail_smtp.php:315, src/Admin/Pages/Settings.php:
|
62 |
msgid "From Name"
|
63 |
msgstr ""
|
64 |
|
@@ -66,7 +66,7 @@ msgstr ""
|
|
66 |
msgid "You can specify the name that emails should be sent from. If you leave this blank, the emails will be sent from WordPress."
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: wp_mail_smtp.php:330, wp_mail_smtp.php:335, src/Admin/Pages/Settings.php:
|
70 |
msgid "Mailer"
|
71 |
msgstr ""
|
72 |
|
@@ -86,15 +86,15 @@ msgstr ""
|
|
86 |
msgid "Looking for high inbox delivery? Try Pepipost with easy setup and free emails. Learn more %1$shere%2$s."
|
87 |
msgstr ""
|
88 |
|
89 |
-
#: wp_mail_smtp.php:371, wp_mail_smtp.php:376, src/Admin/Pages/Settings.php:
|
90 |
msgid "Return Path"
|
91 |
msgstr ""
|
92 |
|
93 |
-
#: wp_mail_smtp.php:381, src/Admin/Pages/Settings.php:
|
94 |
msgid "Set the return-path to match the From Email"
|
95 |
msgstr ""
|
96 |
|
97 |
-
#: wp_mail_smtp.php:385, src/Admin/Pages/Settings.php:
|
98 |
msgid "Return Path indicates where non-delivery receipts - or bounce messages - are to be sent."
|
99 |
msgstr ""
|
100 |
|
@@ -118,15 +118,15 @@ msgstr ""
|
|
118 |
msgid "These options only apply if you have chosen to send mail by SMTP above."
|
119 |
msgstr ""
|
120 |
|
121 |
-
#: wp_mail_smtp.php:425, src/Providers/
|
122 |
msgid "SMTP Host"
|
123 |
msgstr ""
|
124 |
|
125 |
-
#: wp_mail_smtp.php:433, wp_mail_smtp.php:551, src/Providers/
|
126 |
msgid "SMTP Port"
|
127 |
msgstr ""
|
128 |
|
129 |
-
#: wp_mail_smtp.php:440, wp_mail_smtp.php:444, wp_mail_smtp.php:559, wp_mail_smtp.php:565, src/Providers/
|
130 |
msgid "Encryption"
|
131 |
msgstr ""
|
132 |
|
@@ -146,7 +146,7 @@ msgstr ""
|
|
146 |
msgid "TLS is not the same as STARTTLS. For most servers SSL is the recommended option."
|
147 |
msgstr ""
|
148 |
|
149 |
-
#: wp_mail_smtp.php:467, wp_mail_smtp.php:471, src/Providers/
|
150 |
msgid "Authentication"
|
151 |
msgstr ""
|
152 |
|
@@ -182,7 +182,7 @@ msgstr ""
|
|
182 |
msgid "You need to signup on %s to get the SMTP username/password."
|
183 |
msgstr ""
|
184 |
|
185 |
-
#: wp_mail_smtp.php:598, src/Admin/Pages/Test.php:
|
186 |
msgid "Send a Test Email"
|
187 |
msgstr ""
|
188 |
|
@@ -198,7 +198,7 @@ msgstr ""
|
|
198 |
msgid "WP Mail SMTP"
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: wp_mail_smtp.php:758, src/Admin/Area.php:370, src/Admin/Pages/Settings.php:
|
202 |
msgid "Settings"
|
203 |
msgstr ""
|
204 |
|
@@ -226,55 +226,55 @@ msgstr ""
|
|
226 |
msgid "Please rate <strong>WP Mail SMTP</strong> <a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">★★★★★</a> on <a href=\"%2$s\" target=\"_blank\">WordPress.org</a> to help us spread the word. Thank you from the WP Mail SMTP team!"
|
227 |
msgstr ""
|
228 |
|
229 |
-
#: src/Providers/
|
230 |
msgid "None"
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: src/Providers/
|
234 |
msgid "SSL"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: src/Providers/
|
238 |
msgid "TLS"
|
239 |
msgstr ""
|
240 |
|
241 |
-
#: src/Providers/
|
242 |
msgid "For most servers TLS is the recommended option. If your SMTP provider offers both SSL and TLS options, we recommend using TLS."
|
243 |
msgstr ""
|
244 |
|
245 |
-
#: src/Providers/
|
246 |
msgid "Auto TLS"
|
247 |
msgstr ""
|
248 |
|
249 |
-
#: src/Providers/
|
250 |
msgid "On"
|
251 |
msgstr ""
|
252 |
|
253 |
-
#: src/Providers/
|
254 |
msgid "Off"
|
255 |
msgstr ""
|
256 |
|
257 |
-
#: src/Providers/
|
258 |
msgid "By default TLS encryption is automatically used if the server supports it, which is recommended. In some cases, due to server misconfigurations, this can cause issues and may need to be disabled."
|
259 |
msgstr ""
|
260 |
|
261 |
-
#: src/Providers/
|
262 |
msgid "SMTP Username"
|
263 |
msgstr ""
|
264 |
|
265 |
-
#: src/Providers/
|
266 |
msgid "SMTP Password"
|
267 |
msgstr ""
|
268 |
|
269 |
-
#: src/Providers/
|
270 |
msgid "The password is stored in plain text. We highly recommend you setup your password in your WordPress configuration file for improved security; to do this add the lines below to your %s file."
|
271 |
msgstr ""
|
272 |
|
273 |
-
#: src/Providers/
|
274 |
msgid "%1$s requires PHP %2$s to work and does not support your current PHP version %3$s. Please contact your host and request a PHP upgrade to the latest one."
|
275 |
msgstr ""
|
276 |
|
277 |
-
#: src/Providers/
|
278 |
msgid "Meanwhile you can switch to the \"Other SMTP\" Mailer option."
|
279 |
msgstr ""
|
280 |
|
@@ -286,80 +286,76 @@ msgstr ""
|
|
286 |
msgid "General"
|
287 |
msgstr ""
|
288 |
|
289 |
-
#: src/Admin/Pages/Misc.php:67, src/Admin/Pages/Settings.php:
|
290 |
msgid "Save Settings"
|
291 |
msgstr ""
|
292 |
|
293 |
-
#: src/Admin/Pages/Misc.php:95, src/Admin/Pages/Settings.php:
|
294 |
msgid "Settings were successfully saved."
|
295 |
msgstr ""
|
296 |
|
297 |
-
#: src/Admin/Pages/Settings.php:
|
298 |
msgid "Mail"
|
299 |
msgstr ""
|
300 |
|
301 |
-
#: src/Admin/Pages/Settings.php:
|
302 |
msgid "You can specify the email address that emails should be sent from."
|
303 |
msgstr ""
|
304 |
|
305 |
-
#: src/Admin/Pages/Settings.php:
|
306 |
msgid "If you leave this blank, the default one will be used: %s."
|
307 |
msgstr ""
|
308 |
|
309 |
-
#: src/Admin/Pages/Settings.php:
|
310 |
msgid "Please note if you are sending using an email provider (Gmail, Yahoo, Hotmail, Outlook.com, etc) this setting should be your email address for that account."
|
311 |
msgstr ""
|
312 |
|
313 |
-
#: src/Admin/Pages/Settings.php:
|
314 |
msgid "You can specify the name that emails should be sent from."
|
315 |
msgstr ""
|
316 |
|
317 |
-
#: src/Admin/Pages/Settings.php:
|
318 |
msgid "If you leave this blank, the emails will be sent from %s."
|
319 |
msgstr ""
|
320 |
|
321 |
-
#: src/Admin/Pages/Settings.php:
|
322 |
msgid "If unchecked bounce messages may be lost."
|
323 |
msgstr ""
|
324 |
|
325 |
-
#: src/Admin/Pages/Test.php:
|
326 |
msgid "Email Test"
|
327 |
msgstr ""
|
328 |
|
329 |
-
#: src/Admin/Pages/Test.php:
|
330 |
msgid "Send To"
|
331 |
msgstr ""
|
332 |
|
333 |
-
#: src/Admin/Pages/Test.php:
|
334 |
msgid "Type an email address here and then click a button below to generate a test email."
|
335 |
msgstr ""
|
336 |
|
337 |
-
#: src/Admin/Pages/Test.php:
|
338 |
msgid "Send Email"
|
339 |
msgstr ""
|
340 |
|
341 |
-
#: src/Admin/Pages/Test.php:
|
342 |
msgid "Test failed. Please use a valid email address and try to resend the test email."
|
343 |
msgstr ""
|
344 |
|
345 |
-
#: src/Admin/Pages/Test.php:
|
346 |
msgid "Test email to %s"
|
347 |
msgstr ""
|
348 |
|
349 |
-
#: src/Admin/Pages/Test.php:
|
350 |
msgid "This email was sent by %s mailer, and generated by the WP Mail SMTP WordPress plugin."
|
351 |
msgstr ""
|
352 |
|
353 |
-
#: src/Admin/Pages/Test.php:
|
354 |
msgid "Your email was sent successfully!"
|
355 |
msgstr ""
|
356 |
|
357 |
-
#: src/Admin/Pages/Test.php:133
|
358 |
-
msgid "There was a problem while sending a test email."
|
359 |
-
msgstr ""
|
360 |
-
|
361 |
#: src/Admin/Pages/Test.php:134
|
362 |
-
msgid "
|
363 |
msgstr ""
|
364 |
|
365 |
#: src/Admin/Pages/Test.php:136
|
46 |
msgid "WP Mail SMTP Settings"
|
47 |
msgstr ""
|
48 |
|
49 |
+
#: wp_mail_smtp.php:296, src/Admin/Pages/Settings.php:58
|
50 |
msgid "From Email"
|
51 |
msgstr ""
|
52 |
|
58 |
msgid "<strong>Please Note:</strong> You appear to be using a version of WordPress prior to 2.3. Please ignore the From Name field and instead enter Name<email@domain.com> in this field."
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: wp_mail_smtp.php:315, src/Admin/Pages/Settings.php:85
|
62 |
msgid "From Name"
|
63 |
msgstr ""
|
64 |
|
66 |
msgid "You can specify the name that emails should be sent from. If you leave this blank, the emails will be sent from WordPress."
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: wp_mail_smtp.php:330, wp_mail_smtp.php:335, src/Admin/Pages/Settings.php:109
|
70 |
msgid "Mailer"
|
71 |
msgstr ""
|
72 |
|
86 |
msgid "Looking for high inbox delivery? Try Pepipost with easy setup and free emails. Learn more %1$shere%2$s."
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: wp_mail_smtp.php:371, wp_mail_smtp.php:376, src/Admin/Pages/Settings.php:148
|
90 |
msgid "Return Path"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: wp_mail_smtp.php:381, src/Admin/Pages/Settings.php:157
|
94 |
msgid "Set the return-path to match the From Email"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: wp_mail_smtp.php:385, src/Admin/Pages/Settings.php:160
|
98 |
msgid "Return Path indicates where non-delivery receipts - or bounce messages - are to be sent."
|
99 |
msgstr ""
|
100 |
|
118 |
msgid "These options only apply if you have chosen to send mail by SMTP above."
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: wp_mail_smtp.php:425, src/Providers/OptionsAbstract.php:126
|
122 |
msgid "SMTP Host"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: wp_mail_smtp.php:433, wp_mail_smtp.php:551, src/Providers/OptionsAbstract.php:140
|
126 |
msgid "SMTP Port"
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: wp_mail_smtp.php:440, wp_mail_smtp.php:444, wp_mail_smtp.php:559, wp_mail_smtp.php:565, src/Providers/OptionsAbstract.php:154
|
130 |
msgid "Encryption"
|
131 |
msgstr ""
|
132 |
|
146 |
msgid "TLS is not the same as STARTTLS. For most servers SSL is the recommended option."
|
147 |
msgstr ""
|
148 |
|
149 |
+
#: wp_mail_smtp.php:467, wp_mail_smtp.php:471, src/Providers/OptionsAbstract.php:216
|
150 |
msgid "Authentication"
|
151 |
msgstr ""
|
152 |
|
182 |
msgid "You need to signup on %s to get the SMTP username/password."
|
183 |
msgstr ""
|
184 |
|
185 |
+
#: wp_mail_smtp.php:598, src/Admin/Pages/Test.php:49
|
186 |
msgid "Send a Test Email"
|
187 |
msgstr ""
|
188 |
|
198 |
msgid "WP Mail SMTP"
|
199 |
msgstr ""
|
200 |
|
201 |
+
#: wp_mail_smtp.php:758, src/Admin/Area.php:370, src/Admin/Pages/Settings.php:26
|
202 |
msgid "Settings"
|
203 |
msgstr ""
|
204 |
|
226 |
msgid "Please rate <strong>WP Mail SMTP</strong> <a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">★★★★★</a> on <a href=\"%2$s\" target=\"_blank\">WordPress.org</a> to help us spread the word. Thank you from the WP Mail SMTP team!"
|
227 |
msgstr ""
|
228 |
|
229 |
+
#: src/Providers/OptionsAbstract.php:164
|
230 |
msgid "None"
|
231 |
msgstr ""
|
232 |
|
233 |
+
#: src/Providers/OptionsAbstract.php:173
|
234 |
msgid "SSL"
|
235 |
msgstr ""
|
236 |
|
237 |
+
#: src/Providers/OptionsAbstract.php:182
|
238 |
msgid "TLS"
|
239 |
msgstr ""
|
240 |
|
241 |
+
#: src/Providers/OptionsAbstract.php:186
|
242 |
msgid "For most servers TLS is the recommended option. If your SMTP provider offers both SSL and TLS options, we recommend using TLS."
|
243 |
msgstr ""
|
244 |
|
245 |
+
#: src/Providers/OptionsAbstract.php:194
|
246 |
msgid "Auto TLS"
|
247 |
msgstr ""
|
248 |
|
249 |
+
#: src/Providers/OptionsAbstract.php:204, src/Providers/OptionsAbstract.php:226
|
250 |
msgid "On"
|
251 |
msgstr ""
|
252 |
|
253 |
+
#: src/Providers/OptionsAbstract.php:205, src/Providers/OptionsAbstract.php:227
|
254 |
msgid "Off"
|
255 |
msgstr ""
|
256 |
|
257 |
+
#: src/Providers/OptionsAbstract.php:208
|
258 |
msgid "By default TLS encryption is automatically used if the server supports it, which is recommended. In some cases, due to server misconfigurations, this can cause issues and may need to be disabled."
|
259 |
msgstr ""
|
260 |
|
261 |
+
#: src/Providers/OptionsAbstract.php:235
|
262 |
msgid "SMTP Username"
|
263 |
msgstr ""
|
264 |
|
265 |
+
#: src/Providers/OptionsAbstract.php:249
|
266 |
msgid "SMTP Password"
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: src/Providers/OptionsAbstract.php:263
|
270 |
msgid "The password is stored in plain text. We highly recommend you setup your password in your WordPress configuration file for improved security; to do this add the lines below to your %s file."
|
271 |
msgstr ""
|
272 |
|
273 |
+
#: src/Providers/OptionsAbstract.php:300
|
274 |
msgid "%1$s requires PHP %2$s to work and does not support your current PHP version %3$s. Please contact your host and request a PHP upgrade to the latest one."
|
275 |
msgstr ""
|
276 |
|
277 |
+
#: src/Providers/OptionsAbstract.php:307
|
278 |
msgid "Meanwhile you can switch to the \"Other SMTP\" Mailer option."
|
279 |
msgstr ""
|
280 |
|
286 |
msgid "General"
|
287 |
msgstr ""
|
288 |
|
289 |
+
#: src/Admin/Pages/Misc.php:67, src/Admin/Pages/Settings.php:191
|
290 |
msgid "Save Settings"
|
291 |
msgstr ""
|
292 |
|
293 |
+
#: src/Admin/Pages/Misc.php:95, src/Admin/Pages/Settings.php:246
|
294 |
msgid "Settings were successfully saved."
|
295 |
msgstr ""
|
296 |
|
297 |
+
#: src/Admin/Pages/Settings.php:51
|
298 |
msgid "Mail"
|
299 |
msgstr ""
|
300 |
|
301 |
+
#: src/Admin/Pages/Settings.php:67
|
302 |
msgid "You can specify the email address that emails should be sent from."
|
303 |
msgstr ""
|
304 |
|
305 |
+
#: src/Admin/Pages/Settings.php:71
|
306 |
msgid "If you leave this blank, the default one will be used: %s."
|
307 |
msgstr ""
|
308 |
|
309 |
+
#: src/Admin/Pages/Settings.php:77
|
310 |
msgid "Please note if you are sending using an email provider (Gmail, Yahoo, Hotmail, Outlook.com, etc) this setting should be your email address for that account."
|
311 |
msgstr ""
|
312 |
|
313 |
+
#: src/Admin/Pages/Settings.php:94
|
314 |
msgid "You can specify the name that emails should be sent from."
|
315 |
msgstr ""
|
316 |
|
317 |
+
#: src/Admin/Pages/Settings.php:98
|
318 |
msgid "If you leave this blank, the emails will be sent from %s."
|
319 |
msgstr ""
|
320 |
|
321 |
+
#: src/Admin/Pages/Settings.php:161
|
322 |
msgid "If unchecked bounce messages may be lost."
|
323 |
msgstr ""
|
324 |
|
325 |
+
#: src/Admin/Pages/Test.php:27
|
326 |
msgid "Email Test"
|
327 |
msgstr ""
|
328 |
|
329 |
+
#: src/Admin/Pages/Test.php:56
|
330 |
msgid "Send To"
|
331 |
msgstr ""
|
332 |
|
333 |
+
#: src/Admin/Pages/Test.php:61
|
334 |
msgid "Type an email address here and then click a button below to generate a test email."
|
335 |
msgstr ""
|
336 |
|
337 |
+
#: src/Admin/Pages/Test.php:67
|
338 |
msgid "Send Email"
|
339 |
msgstr ""
|
340 |
|
341 |
+
#: src/Admin/Pages/Test.php:87
|
342 |
msgid "Test failed. Please use a valid email address and try to resend the test email."
|
343 |
msgstr ""
|
344 |
|
345 |
+
#: src/Admin/Pages/Test.php:111
|
346 |
msgid "Test email to %s"
|
347 |
msgstr ""
|
348 |
|
349 |
+
#: src/Admin/Pages/Test.php:114
|
350 |
msgid "This email was sent by %s mailer, and generated by the WP Mail SMTP WordPress plugin."
|
351 |
msgstr ""
|
352 |
|
353 |
+
#: src/Admin/Pages/Test.php:127
|
354 |
msgid "Your email was sent successfully!"
|
355 |
msgstr ""
|
356 |
|
|
|
|
|
|
|
|
|
357 |
#: src/Admin/Pages/Test.php:134
|
358 |
+
msgid "There was a problem while sending a test email. Related debugging output is shown below:"
|
359 |
msgstr ""
|
360 |
|
361 |
#: src/Admin/Pages/Test.php:136
|
readme.txt
CHANGED
@@ -1,332 +1,336 @@
|
|
1 |
-
=== WP Mail SMTP by WPForms ===
|
2 |
-
Contributors: wpforms, jaredatch, smub, slaFFik
|
3 |
-
Tags: smtp, wp mail smtp, wordpress smtp, gmail smtp, sendgrid smtp, mailgun smtp, mail, mailer, phpmailer, wp_mail, email, mailgun, sengrid, gmail, wp smtp
|
4 |
-
Requires at least: 3.6
|
5 |
-
Tested up to: 4.9
|
6 |
-
Stable tag: trunk
|
7 |
-
Requires PHP: 5.3
|
8 |
-
|
9 |
-
The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 700k sites.
|
10 |
-
|
11 |
-
== Description ==
|
12 |
-
|
13 |
-
= WordPress Mail SMTP Plugin =
|
14 |
-
|
15 |
-
Having problems with your WordPress site not sending emails? You're not alone. Over 700,000 websites use WP Mail SMTP to fix their email deliverability issues.
|
16 |
-
|
17 |
-
WP Mail SMTP fixes your email deliverability by reconfiguring the wp_mail() PHP function to use a proper SMTP provider.
|
18 |
-
|
19 |
-
= What is SMTP? =
|
20 |
-
|
21 |
-
SMTP (Simple Mail Transfer Protocol) is an industry standard for sending emails. SMTP helps increase email deliverability by using proper authentication.
|
22 |
-
|
23 |
-
Popular email clients like Gmail, Yahoo, Outlook, etc are constantly improving their services to reduce email spam. One of the things their spam tools look for is whether an email is originating from the location it claims to be originating from.
|
24 |
-
|
25 |
-
If the proper authentication isn't there, then the emails either go in your SPAM folder or worst not get delivered at all.
|
26 |
-
|
27 |
-
This is a problem for a lot of WordPress sites because by default, WordPress uses the PHP mail function to send emails generated by WordPress or any contact form plugin like <a href="https://wpforms.com/" rel="friend">WPForms</a>.
|
28 |
-
|
29 |
-
The issue is that most <a href"http://www.wpbeginner.com/wordpress-hosting/" rel="friend">WordPress hosting companies</a> don't have their servers properly configured for sending PHP emails.
|
30 |
-
|
31 |
-
The combination of two causes your WordPress emails to not get delivered.
|
32 |
-
|
33 |
-
= How does WP Mail SMTP work? =
|
34 |
-
|
35 |
-
WP Mail SMTP plugin allows you to easily reconfigure the wp_mail() function to use a trusted SMTP provider.
|
36 |
-
|
37 |
-
This helps you fix all WordPress not sending email issues.
|
38 |
-
|
39 |
-
WP Mail SMTP plugin includes four different SMTP setup options:
|
40 |
-
|
41 |
-
1. Mailgun SMTP
|
42 |
-
2. SendGrid SMTP
|
43 |
-
3. Gmail SMTP
|
44 |
-
4. All Other SMTP
|
45 |
-
|
46 |
-
For all options, you can specify the "from name" and "email address" for outgoing emails.
|
47 |
-
|
48 |
-
Instead of having users use different SMTP plugins and workflows for different SMTP providers, we decided to bring it all in one. This is what makes WP Mail SMTP, the best SMTP solution for WordPress.
|
49 |
-
|
50 |
-
= Mailgun SMTP =
|
51 |
-
|
52 |
-
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.
|
53 |
-
|
54 |
-
WP Mail SMTP plugin offers a native integration with MailGun. All you have to do is connect your Mailgun account, and you will improve your email deliverability.
|
55 |
-
|
56 |
-
Read our <a href="https://wpforms.com/how-to-send-wordpress-emails-with-mailgun/" rel="friend">Mailgun documentation</a> for more details.
|
57 |
-
|
58 |
-
= Gmail SMTP =
|
59 |
-
|
60 |
-
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.
|
61 |
-
|
62 |
-
This allows you to use your <a href="http://www.wpbeginner.com/beginners-guide/how-to-setup-a-professional-email-address-with-gmail-and-google-apps/" rel="friend">professional email address</a> and improve email deliverability.
|
63 |
-
|
64 |
-
Unlike other Gmail SMTP plugins, our Gmail SMTP option uses OAuth to authenticate your Google account, keeping your login information 100% secure.
|
65 |
-
|
66 |
-
Read our <a href="https://wpforms.com/how-to-securely-send-wordpress-emails-using-gmail-smtp/" rel="friend">Gmail documentation</a> for more details.
|
67 |
-
|
68 |
-
= SendGrid SMTP =
|
69 |
-
|
70 |
-
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.
|
71 |
-
|
72 |
-
Read our <a href="https://wpforms.com/fix-wordpress-email-notifications-with-sendgrid/" rel="friend">SendGrid documentation</a> for more details.
|
73 |
-
|
74 |
-
= Other SMTP =
|
75 |
-
|
76 |
-
WP Mail SMTP plugin also works with all major email services such as Gmail, Yahoo, Outlook, Microsoft Live, and any other email sending service that offers SMTP.
|
77 |
-
|
78 |
-
You can set the following options:
|
79 |
-
|
80 |
-
* Specify an SMTP host.
|
81 |
-
* Specify an SMTP port.
|
82 |
-
* Choose SSL / TLS encryption.
|
83 |
-
* Choose to use SMTP authentication or not.
|
84 |
-
* Specify an SMTP username and password.
|
85 |
-
|
86 |
-
WP Mail SMTP also gives you the option to insert your password in your wp-config.php file, so it's not visible in your WordPress settings.
|
87 |
-
|
88 |
-
To see recommended settings for the popular services as well as troubleshooting tips, check out our <a href="https://wpforms.com/docs/how-to-set-up-smtp-using-the-wp-mail-smtp-plugin/" rel="friend">SMTP documentation</a>.
|
89 |
-
|
90 |
-
We hope that you find WP Mail SMTP plugin helpful.
|
91 |
-
|
92 |
-
= Credits =
|
93 |
-
|
94 |
-
WP Mail SMTP plugin was originally created by Callum Macdonald. It is now owned and maintained by the team behind <a href="https://wpforms.com/" rel="friend">WPForms</a> - the best drag & drop form builder for WordPress.
|
95 |
-
|
96 |
-
You can try the <a href="https://wordpress.org/plugins/wpforms-lite/" rel="friend">free version of WPForms plugin</a> to see why it's the best in the market.
|
97 |
-
|
98 |
-
= What's Next =
|
99 |
-
|
100 |
-
If you like this plugin, then please consider checking out our other popular plugins:
|
101 |
-
|
102 |
-
* <a href="http://optinmonster.com/" rel="friend" title="OptinMonster">OptinMonster</a> - Get More Email Subscribers
|
103 |
-
* <a href="https://www.monsterinsights.com/" rel="friend" title="MonsterInsights">MonsterInsights</a> - Best Google Analytics Plugin for WordPress
|
104 |
-
|
105 |
-
Visit <a href="http://www.wpbeginner.com/" rel="friend" title="WPBeginner">WPBeginner</a> to learn from our <a href="http://www.wpbeginner.com/category/wp-tutorials/" rel="friend" title="WordPress Tutorials">WordPress Tutorials</a> and find out about other <a href="http://www.wpbeginner.com/category/plugins/" rel="friend" title="Best WordPress Plugins">best WordPress plugins</a>.
|
106 |
-
|
107 |
-
== Installation ==
|
108 |
-
|
109 |
-
1. Install WP Mail SMTP by WPForms either via the WordPress.org plugin repository or by uploading the files to your server. (See instructions on <a href="http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/" rel="friend">how to install a WordPress plugin</a>)
|
110 |
-
2. Activate WP Mail SMTP by WPForms.
|
111 |
-
3. Navigate to the Settings area of WP Mail SMTP in the WordPress admin.
|
112 |
-
4. Choose your SMTP option (Mailgun SMTP, SendGrid SMTP, Gmail SMTP, or Other SMTP) and follow the instructions to set it up.
|
113 |
-
5. Want to support us? Consider trying <a href="https://wpforms.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion" rel="friend" title="WPForms">WPForms Pro</a> - the best WordPress contact form plugin!
|
114 |
-
|
115 |
-
== Frequently Asked Questions ==
|
116 |
-
|
117 |
-
= Can I use this plugin to send email via Gmail, G Suite, Outlook.com, Office 365, Hotmail, Yahoo, or AOL SMTP? =
|
118 |
-
|
119 |
-
Yes! We have extensive documentation that covers setting up SMTP most popular email services.
|
120 |
-
|
121 |
-
<a href="https://wpforms.com/docs/how-to-set-up-smtp-using-the-wp-mail-smtp-plugin/" rel="friend">Read our docs</a> to see the correct SMTP settings for each service.
|
122 |
-
|
123 |
-
= Help! I need support or have an issue. =
|
124 |
-
|
125 |
-
Please read <a href="https://wordpress.org/support/topic/wp-mail-smtp-support-policy/">our support policy</a> for more information.
|
126 |
-
|
127 |
-
= I found a bug, now what? =
|
128 |
-
|
129 |
-
If you've stumbled upon a bug, the best place to report it is in the <a href="https://github.com/awesomemotive/wp-mail-smtp">WP Mail SMTP GitHub repository</a>. GitHub is where the plugin is actively developed, and posting there will get your issue quickly seen by our developers (myself and Slava). Once posted, we'll review your bug report and triage the bug. When creating an issue, the more details you can add to your report, the faster the bug can be solved.
|
130 |
-
|
131 |
-
= Can you add feature x, y or z to the plugin? =
|
132 |
-
|
133 |
-
Short answer: maybe.
|
134 |
-
|
135 |
-
By all means please contact us to discuss features or options you'd like to see added to the plugin. We can't guarantee to add all of them, but we will consider all sensible requests. We can be contacted here:
|
136 |
-
<a href="https://wpforms.com/contact/" rel="friend">https://wpforms.com/contact/</a>
|
137 |
-
|
138 |
-
== Screenshots ==
|
139 |
-
|
140 |
-
1. WP Mail SMTP Settings page
|
141 |
-
2. Gmail / G Suite settings
|
142 |
-
3. Mailgun settings
|
143 |
-
4. SendGrid settings
|
144 |
-
5. SMTP settings
|
145 |
-
6. Send a Test Email
|
146 |
-
|
147 |
-
== Changelog ==
|
148 |
-
|
149 |
-
= 1.
|
150 |
-
*
|
151 |
-
* Changed: Improve debug output
|
152 |
-
|
153 |
-
|
154 |
-
*
|
155 |
-
*
|
156 |
-
*
|
157 |
-
*
|
158 |
-
|
159 |
-
|
160 |
-
* Fixed:
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
*
|
168 |
-
|
169 |
-
|
170 |
-
* Added:
|
171 |
-
*
|
172 |
-
*
|
173 |
-
*
|
174 |
-
*
|
175 |
-
* Changed:
|
176 |
-
|
177 |
-
|
178 |
-
*
|
179 |
-
* Changed:
|
180 |
-
|
181 |
-
= 0.11.
|
182 |
-
*
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
*
|
187 |
-
|
188 |
-
|
189 |
-
*
|
190 |
-
*
|
191 |
-
*
|
192 |
-
*
|
193 |
-
* Changed:
|
194 |
-
* Changed:
|
195 |
-
|
196 |
-
|
197 |
-
*
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
*
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
*
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
*
|
237 |
-
|
238 |
-
= 0.8.
|
239 |
-
*
|
240 |
-
*
|
241 |
-
|
242 |
-
= 0.8.
|
243 |
-
* Bugfix,
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
|
|
|
|
|
|
|
1 |
+
=== WP Mail SMTP by WPForms ===
|
2 |
+
Contributors: wpforms, jaredatch, smub, slaFFik
|
3 |
+
Tags: smtp, wp mail smtp, wordpress smtp, gmail smtp, sendgrid smtp, mailgun smtp, mail, mailer, phpmailer, wp_mail, email, mailgun, sengrid, gmail, wp smtp
|
4 |
+
Requires at least: 3.6
|
5 |
+
Tested up to: 4.9
|
6 |
+
Stable tag: trunk
|
7 |
+
Requires PHP: 5.3
|
8 |
+
|
9 |
+
The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 700k sites.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
= WordPress Mail SMTP Plugin =
|
14 |
+
|
15 |
+
Having problems with your WordPress site not sending emails? You're not alone. Over 700,000 websites use WP Mail SMTP to fix their email deliverability issues.
|
16 |
+
|
17 |
+
WP Mail SMTP fixes your email deliverability by reconfiguring the wp_mail() PHP function to use a proper SMTP provider.
|
18 |
+
|
19 |
+
= What is SMTP? =
|
20 |
+
|
21 |
+
SMTP (Simple Mail Transfer Protocol) is an industry standard for sending emails. SMTP helps increase email deliverability by using proper authentication.
|
22 |
+
|
23 |
+
Popular email clients like Gmail, Yahoo, Outlook, etc are constantly improving their services to reduce email spam. One of the things their spam tools look for is whether an email is originating from the location it claims to be originating from.
|
24 |
+
|
25 |
+
If the proper authentication isn't there, then the emails either go in your SPAM folder or worst not get delivered at all.
|
26 |
+
|
27 |
+
This is a problem for a lot of WordPress sites because by default, WordPress uses the PHP mail function to send emails generated by WordPress or any contact form plugin like <a href="https://wpforms.com/" rel="friend">WPForms</a>.
|
28 |
+
|
29 |
+
The issue is that most <a href"http://www.wpbeginner.com/wordpress-hosting/" rel="friend">WordPress hosting companies</a> don't have their servers properly configured for sending PHP emails.
|
30 |
+
|
31 |
+
The combination of two causes your WordPress emails to not get delivered.
|
32 |
+
|
33 |
+
= How does WP Mail SMTP work? =
|
34 |
+
|
35 |
+
WP Mail SMTP plugin allows you to easily reconfigure the wp_mail() function to use a trusted SMTP provider.
|
36 |
+
|
37 |
+
This helps you fix all WordPress not sending email issues.
|
38 |
+
|
39 |
+
WP Mail SMTP plugin includes four different SMTP setup options:
|
40 |
+
|
41 |
+
1. Mailgun SMTP
|
42 |
+
2. SendGrid SMTP
|
43 |
+
3. Gmail SMTP
|
44 |
+
4. All Other SMTP
|
45 |
+
|
46 |
+
For all options, you can specify the "from name" and "email address" for outgoing emails.
|
47 |
+
|
48 |
+
Instead of having users use different SMTP plugins and workflows for different SMTP providers, we decided to bring it all in one. This is what makes WP Mail SMTP, the best SMTP solution for WordPress.
|
49 |
+
|
50 |
+
= Mailgun SMTP =
|
51 |
+
|
52 |
+
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.
|
53 |
+
|
54 |
+
WP Mail SMTP plugin offers a native integration with MailGun. All you have to do is connect your Mailgun account, and you will improve your email deliverability.
|
55 |
+
|
56 |
+
Read our <a href="https://wpforms.com/how-to-send-wordpress-emails-with-mailgun/" rel="friend">Mailgun documentation</a> for more details.
|
57 |
+
|
58 |
+
= Gmail SMTP =
|
59 |
+
|
60 |
+
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.
|
61 |
+
|
62 |
+
This allows you to use your <a href="http://www.wpbeginner.com/beginners-guide/how-to-setup-a-professional-email-address-with-gmail-and-google-apps/" rel="friend">professional email address</a> and improve email deliverability.
|
63 |
+
|
64 |
+
Unlike other Gmail SMTP plugins, our Gmail SMTP option uses OAuth to authenticate your Google account, keeping your login information 100% secure.
|
65 |
+
|
66 |
+
Read our <a href="https://wpforms.com/how-to-securely-send-wordpress-emails-using-gmail-smtp/" rel="friend">Gmail documentation</a> for more details.
|
67 |
+
|
68 |
+
= SendGrid SMTP =
|
69 |
+
|
70 |
+
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.
|
71 |
+
|
72 |
+
Read our <a href="https://wpforms.com/fix-wordpress-email-notifications-with-sendgrid/" rel="friend">SendGrid documentation</a> for more details.
|
73 |
+
|
74 |
+
= Other SMTP =
|
75 |
+
|
76 |
+
WP Mail SMTP plugin also works with all major email services such as Gmail, Yahoo, Outlook, Microsoft Live, and any other email sending service that offers SMTP.
|
77 |
+
|
78 |
+
You can set the following options:
|
79 |
+
|
80 |
+
* Specify an SMTP host.
|
81 |
+
* Specify an SMTP port.
|
82 |
+
* Choose SSL / TLS encryption.
|
83 |
+
* Choose to use SMTP authentication or not.
|
84 |
+
* Specify an SMTP username and password.
|
85 |
+
|
86 |
+
WP Mail SMTP also gives you the option to insert your password in your wp-config.php file, so it's not visible in your WordPress settings.
|
87 |
+
|
88 |
+
To see recommended settings for the popular services as well as troubleshooting tips, check out our <a href="https://wpforms.com/docs/how-to-set-up-smtp-using-the-wp-mail-smtp-plugin/" rel="friend">SMTP documentation</a>.
|
89 |
+
|
90 |
+
We hope that you find WP Mail SMTP plugin helpful.
|
91 |
+
|
92 |
+
= Credits =
|
93 |
+
|
94 |
+
WP Mail SMTP plugin was originally created by Callum Macdonald. It is now owned and maintained by the team behind <a href="https://wpforms.com/" rel="friend">WPForms</a> - the best drag & drop form builder for WordPress.
|
95 |
+
|
96 |
+
You can try the <a href="https://wordpress.org/plugins/wpforms-lite/" rel="friend">free version of WPForms plugin</a> to see why it's the best in the market.
|
97 |
+
|
98 |
+
= What's Next =
|
99 |
+
|
100 |
+
If you like this plugin, then please consider checking out our other popular plugins:
|
101 |
+
|
102 |
+
* <a href="http://optinmonster.com/" rel="friend" title="OptinMonster">OptinMonster</a> - Get More Email Subscribers
|
103 |
+
* <a href="https://www.monsterinsights.com/" rel="friend" title="MonsterInsights">MonsterInsights</a> - Best Google Analytics Plugin for WordPress
|
104 |
+
|
105 |
+
Visit <a href="http://www.wpbeginner.com/" rel="friend" title="WPBeginner">WPBeginner</a> to learn from our <a href="http://www.wpbeginner.com/category/wp-tutorials/" rel="friend" title="WordPress Tutorials">WordPress Tutorials</a> and find out about other <a href="http://www.wpbeginner.com/category/plugins/" rel="friend" title="Best WordPress Plugins">best WordPress plugins</a>.
|
106 |
+
|
107 |
+
== Installation ==
|
108 |
+
|
109 |
+
1. Install WP Mail SMTP by WPForms either via the WordPress.org plugin repository or by uploading the files to your server. (See instructions on <a href="http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/" rel="friend">how to install a WordPress plugin</a>)
|
110 |
+
2. Activate WP Mail SMTP by WPForms.
|
111 |
+
3. Navigate to the Settings area of WP Mail SMTP in the WordPress admin.
|
112 |
+
4. Choose your SMTP option (Mailgun SMTP, SendGrid SMTP, Gmail SMTP, or Other SMTP) and follow the instructions to set it up.
|
113 |
+
5. Want to support us? Consider trying <a href="https://wpforms.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion" rel="friend" title="WPForms">WPForms Pro</a> - the best WordPress contact form plugin!
|
114 |
+
|
115 |
+
== Frequently Asked Questions ==
|
116 |
+
|
117 |
+
= Can I use this plugin to send email via Gmail, G Suite, Outlook.com, Office 365, Hotmail, Yahoo, or AOL SMTP? =
|
118 |
+
|
119 |
+
Yes! We have extensive documentation that covers setting up SMTP most popular email services.
|
120 |
+
|
121 |
+
<a href="https://wpforms.com/docs/how-to-set-up-smtp-using-the-wp-mail-smtp-plugin/" rel="friend">Read our docs</a> to see the correct SMTP settings for each service.
|
122 |
+
|
123 |
+
= Help! I need support or have an issue. =
|
124 |
+
|
125 |
+
Please read <a href="https://wordpress.org/support/topic/wp-mail-smtp-support-policy/">our support policy</a> for more information.
|
126 |
+
|
127 |
+
= I found a bug, now what? =
|
128 |
+
|
129 |
+
If you've stumbled upon a bug, the best place to report it is in the <a href="https://github.com/awesomemotive/wp-mail-smtp">WP Mail SMTP GitHub repository</a>. GitHub is where the plugin is actively developed, and posting there will get your issue quickly seen by our developers (myself and Slava). Once posted, we'll review your bug report and triage the bug. When creating an issue, the more details you can add to your report, the faster the bug can be solved.
|
130 |
+
|
131 |
+
= Can you add feature x, y or z to the plugin? =
|
132 |
+
|
133 |
+
Short answer: maybe.
|
134 |
+
|
135 |
+
By all means please contact us to discuss features or options you'd like to see added to the plugin. We can't guarantee to add all of them, but we will consider all sensible requests. We can be contacted here:
|
136 |
+
<a href="https://wpforms.com/contact/" rel="friend">https://wpforms.com/contact/</a>
|
137 |
+
|
138 |
+
== Screenshots ==
|
139 |
+
|
140 |
+
1. WP Mail SMTP Settings page
|
141 |
+
2. Gmail / G Suite settings
|
142 |
+
3. Mailgun settings
|
143 |
+
4. SendGrid settings
|
144 |
+
5. SMTP settings
|
145 |
+
6. Send a Test Email
|
146 |
+
|
147 |
+
== Changelog ==
|
148 |
+
|
149 |
+
= 1.2.0 - 2017-12-21 =
|
150 |
+
* Fixed: Decrease the factual minimum WordPress version from 3.9 to 3.6.
|
151 |
+
* Changed: Improve debug output for all mail providers.
|
152 |
+
|
153 |
+
= 1.1.0 - 2017-12-18 =
|
154 |
+
* Added: New option "Auto TLS" for SMTP mailer. Default is enabled. Migration routine for all sites.
|
155 |
+
* Changed: Improve debug output - clear styles and context-aware content.
|
156 |
+
* Changed: Better exceptions handling for Google authentication process.
|
157 |
+
* Changed: Do not sanitize passwords, api keys etc - as they may contain special characters in certain order and sanitization will break those values.
|
158 |
+
* Changed: Improve wording of some helpful texts inside plugin admin area.
|
159 |
+
* Fixed: Do not include certain files in dependency libraries that are not used by Google mailer. This should stop flagging plugin by Wordfence and VaultPress.
|
160 |
+
* Fixed: Constants usage is working now, to define the SMTP password, for example.
|
161 |
+
* Fixed: Notice for default mailer.
|
162 |
+
|
163 |
+
= 1.0.2 - 2017-12-12 =
|
164 |
+
* Fixed: PHPMailer using incorrect SMTPSecure value.
|
165 |
+
|
166 |
+
= 1.0.1 - 2017-12-12 =
|
167 |
+
* Fixed: Global POST processing conflict.
|
168 |
+
|
169 |
+
= 1.0.0 - 2017-12-12 =
|
170 |
+
* Added: Automatic migration tool to move options from older storage format to a new one.
|
171 |
+
* Added: Added Gmail & G Suite email provider integration - without your email and password.
|
172 |
+
* Added: Added SendGrid email provider integration - using the API key only.
|
173 |
+
* Added: Added Mailgun email provider integration - using the API key and configured domain only.
|
174 |
+
* Added: New compatibility mode - for PHP 5.2 old plugin will be loaded, for PHP 5.3 and higher - new version of admin area and new functionality.
|
175 |
+
* Changed: The new look of the admin area.
|
176 |
+
* Changed: SMTP password field now has "password" type.
|
177 |
+
* Changed: SMTP password field does not display real password at all when using constants in `wp-config.php` to define it.
|
178 |
+
* Changed: Escape properly all translations.
|
179 |
+
* Changed: More helpful test email content (with a mailer name).
|
180 |
+
|
181 |
+
= 0.11.2 - 2017-11-28 =
|
182 |
+
* Added: Setting to hide announcement feed.
|
183 |
+
* Changed: Announcement feed data.
|
184 |
+
|
185 |
+
= 0.11.1 - 2017-10-30 =
|
186 |
+
* Fixed: Older PHP compatibility fix.
|
187 |
+
|
188 |
+
= 0.11 - 2017-10-30 =
|
189 |
+
* Added: Helper description to Return Path option.
|
190 |
+
* Added: Filter `wp_mail_smtp_admin_test_email_smtp_debug` to increase the debug message verbosity.
|
191 |
+
* Added: PHP 5.2 notice.
|
192 |
+
* Added: Announcement feed.
|
193 |
+
* Changed: Localization fixes, proper locale name.
|
194 |
+
* Changed: Code style improvements and optimizations for both HTML and PHP.
|
195 |
+
* Changed: Inputs for emails now have a proper type `email`, instead of a generic `text`.
|
196 |
+
* Changed: Turn off `$phpmailer->SMTPAutoTLS` when `No encryption` option is set to prevent error while sending emails.
|
197 |
+
* Changed: Hide Pepipost for those who are not using it.
|
198 |
+
* Changed: WP CLI support improved.
|
199 |
+
|
200 |
+
= 0.10.1 =
|
201 |
+
* Addition of Pepipost and cleanup of admin page.
|
202 |
+
|
203 |
+
= 0.10.0 =
|
204 |
+
* Addition of Pepipost and cleanup of admin page.
|
205 |
+
|
206 |
+
= 0.9.6 =
|
207 |
+
* Minor security fix, sanitize test email address.
|
208 |
+
|
209 |
+
= 0.9.5 =
|
210 |
+
* Minor security fix, hat tip JD Grimes.
|
211 |
+
|
212 |
+
= 0.9.4 =
|
213 |
+
* Improvement to the test email function, very low priority update.
|
214 |
+
|
215 |
+
= 0.9.3 =
|
216 |
+
* Fixing reported issue with passing by reference. props Adam Conway
|
217 |
+
|
218 |
+
= 0.9.2 =
|
219 |
+
* Removing the deprecation notice.
|
220 |
+
|
221 |
+
= 0.9.1 =
|
222 |
+
* $phpmailer->language became protected in WP 3.2, no longer unset on debug output.
|
223 |
+
|
224 |
+
= 0.9.0 =
|
225 |
+
* Typo in the From email description.
|
226 |
+
* Removed changelog from plugin file, no need to duplicate it.
|
227 |
+
* Optionally set $phpmailer->Sender from from email, helps with sendmail / mail().
|
228 |
+
|
229 |
+
= 0.8.7 =
|
230 |
+
* Fix for a long standing bug that caused an error during plugin activation.
|
231 |
+
|
232 |
+
= 0.8.6 =
|
233 |
+
* The Settings link really does work this time, promise. Apologies for the unnecessary updates.
|
234 |
+
|
235 |
+
= 0.8.5 =
|
236 |
+
* Bugfix, the settings link on the Plugin page was broken by 0.8.4.
|
237 |
+
|
238 |
+
= 0.8.4 =
|
239 |
+
* Minor bugfix, remove use of esc_html() to improve backwards compatibility.
|
240 |
+
* Removed second options page menu props ovidiu.
|
241 |
+
|
242 |
+
= 0.8.3 =
|
243 |
+
* Bugfix, return WPMS_MAIL_FROM_NAME, props nacin.
|
244 |
+
* Add Settings link, props Mike Challis http://profiles.wordpress.org/MikeChallis/
|
245 |
+
|
246 |
+
= 0.8.2 =
|
247 |
+
* Bugfix, call phpmailer_init_smtp() correctly, props Sinklar.
|
248 |
+
|
249 |
+
= 0.8.1 =
|
250 |
+
* Internationalisation improvements.
|
251 |
+
|
252 |
+
= 0.8 =
|
253 |
+
* Added port, SSL/TLS, option whitelisting, validate_email(), and constant options.
|
254 |
+
|
255 |
+
= 0.7 =
|
256 |
+
* Added checks to only override the default from name / email
|
257 |
+
|
258 |
+
= 0.6 =
|
259 |
+
* Added additional SMTP debugging output
|
260 |
+
|
261 |
+
= 0.5.2 =
|
262 |
+
* Fixed a pre 2.3 bug to do with mail from
|
263 |
+
|
264 |
+
= 0.5.1 =
|
265 |
+
* Added a check to display a warning on versions prior to 2.3
|
266 |
+
|
267 |
+
= 0.5.0 =
|
268 |
+
* Upgraded to match 2.3 filters which add a second filter for from name
|
269 |
+
|
270 |
+
= 0.4.2 =
|
271 |
+
* Fixed a bug in 0.4.1 and added more debugging output
|
272 |
+
|
273 |
+
= 0.4.1 =
|
274 |
+
* Added $phpmailer->ErroInfo to the test mail output
|
275 |
+
|
276 |
+
= 0.4 =
|
277 |
+
* Added the test email feature and cleaned up some other bits and pieces
|
278 |
+
|
279 |
+
= 0.3.2 =
|
280 |
+
* Changed to use register_activation_hook for greater compatability
|
281 |
+
|
282 |
+
= 0.3.1 =
|
283 |
+
* Added readme for WP-Plugins.org compatability
|
284 |
+
|
285 |
+
= 0.3 =
|
286 |
+
* Various bugfixes and added From options
|
287 |
+
|
288 |
+
= 0.2 =
|
289 |
+
* Reworked approach as suggested by westi, added options page
|
290 |
+
|
291 |
+
= 0.1 =
|
292 |
+
* Initial approach, copying the wp_mail function and replacing it
|
293 |
+
|
294 |
+
== Upgrade Notice ==
|
295 |
+
|
296 |
+
= 0.10.1 =
|
297 |
+
Addition of Pepipost and cleanup of admin page.
|
298 |
+
|
299 |
+
= 0.10.0 =
|
300 |
+
Addition of Pepipost and cleanup of admin page.
|
301 |
+
|
302 |
+
= 0.9.6 =
|
303 |
+
Minor security fix, sanitize test email address.
|
304 |
+
|
305 |
+
= 0.9.5 =
|
306 |
+
Minor security fix, hat tip JD Grimes.
|
307 |
+
|
308 |
+
= 0.9.4 =
|
309 |
+
Improvement to the test email function, very low priority update.
|
310 |
+
|
311 |
+
= 0.9.3 =
|
312 |
+
Fixing reported issue with passing by reference.
|
313 |
+
|
314 |
+
= 0.9.2 =
|
315 |
+
Removing the deprecation notice.
|
316 |
+
|
317 |
+
= 0.9.1 =
|
318 |
+
Test mail functionality was broken on upgrade to 3.2, now restored.
|
319 |
+
|
320 |
+
= 0.9.0 =
|
321 |
+
Low priority upgrade. Improves the appearance of the options page.
|
322 |
+
|
323 |
+
= 0.8.7 =
|
324 |
+
Very low priority update. Fixes a bug that causes a spurious error during activation.
|
325 |
+
|
326 |
+
= 0.8.6 =
|
327 |
+
Low priority update. The Settings link was still broken in 0.8.5.
|
328 |
+
|
329 |
+
= 0.8.5 =
|
330 |
+
Minor bugfix correcting the Settings link bug introduced in 0.8.4. Very low priority update.
|
331 |
+
|
332 |
+
= 0.8.4 =
|
333 |
+
Minor bugfix for users using constants. Another very low priority upgrade. Apologies for the version creep.
|
334 |
+
|
335 |
+
= 0.8.3 =
|
336 |
+
Minor bugfix for users using constants. Very low priority upgrade.
|
src/Admin/Pages/Auth.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
namespace WPMailSMTP\Admin\Pages;
|
4 |
|
5 |
use WPMailSMTP\Options;
|
|
|
6 |
|
7 |
/**
|
8 |
* Class Auth.
|
@@ -25,7 +26,9 @@ class Auth {
|
|
25 |
|
26 |
$auth = wp_mail_smtp()->get_providers()->get_auth( Options::init()->get( 'mail', 'mailer' ) );
|
27 |
|
28 |
-
$auth
|
|
|
|
|
29 |
}
|
30 |
|
31 |
/**
|
3 |
namespace WPMailSMTP\Admin\Pages;
|
4 |
|
5 |
use WPMailSMTP\Options;
|
6 |
+
use WPMailSMTP\Providers\AuthAbstract;
|
7 |
|
8 |
/**
|
9 |
* Class Auth.
|
26 |
|
27 |
$auth = wp_mail_smtp()->get_providers()->get_auth( Options::init()->get( 'mail', 'mailer' ) );
|
28 |
|
29 |
+
if ( $auth && $auth instanceof AuthAbstract ) {
|
30 |
+
$auth->process();
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
/**
|
src/Admin/Pages/Settings.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
namespace WPMailSMTP\Admin\Pages;
|
4 |
|
5 |
use WPMailSMTP\Admin\PageAbstract;
|
|
|
6 |
use WPMailSMTP\Options;
|
7 |
use WPMailSMTP\WP;
|
8 |
|
@@ -87,7 +88,7 @@ class Settings extends PageAbstract {
|
|
87 |
<input name="wp-mail-smtp[mail][from_name]" type="text"
|
88 |
value="<?php echo esc_attr( $options->get( 'mail', 'from_name' ) ); ?>"
|
89 |
<?php echo $options->is_const_defined( 'mail', 'from_name' ) ? 'disabled' : ''; ?>
|
90 |
-
id="wp-mail-smtp-setting-
|
91 |
/>
|
92 |
<p class="desc">
|
93 |
<?php esc_html_e( 'You can specify the name that emails should be sent from.', 'wp-mail-smtp' ); ?><br/>
|
@@ -112,6 +113,12 @@ class Settings extends PageAbstract {
|
|
112 |
|
113 |
<?php foreach ( wp_mail_smtp()->get_providers()->get_options_all() as $provider ) : ?>
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
<div class="wp-mail-smtp-mailer <?php echo $mailer === $provider->get_slug() ? 'active' : ''; ?>">
|
116 |
<div class="wp-mail-smtp-mailer-image">
|
117 |
<img src="<?php echo esc_url( $provider->get_logo_url() ); ?>"
|
@@ -146,7 +153,9 @@ class Settings extends PageAbstract {
|
|
146 |
<?php echo $options->is_const_defined( 'mail', 'return_path' ) ? 'disabled' : ''; ?>
|
147 |
id="wp-mail-smtp-setting-return_path"
|
148 |
/>
|
149 |
-
<label for="wp-mail-smtp-setting-return_path"
|
|
|
|
|
150 |
<p class="desc">
|
151 |
<?php esc_html_e( 'Return Path indicates where non-delivery receipts - or bounce messages - are to be sent.', 'wp-mail-smtp' ); ?><br/>
|
152 |
<?php esc_html_e( 'If unchecked bounce messages may be lost.', 'wp-mail-smtp' ); ?>
|
@@ -162,7 +171,7 @@ class Settings extends PageAbstract {
|
|
162 |
|
163 |
<!-- Mailer Option Title -->
|
164 |
<?php $provider_desc = $provider->get_description(); ?>
|
165 |
-
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading <?php empty( $provider_desc ) ? 'no-desc' : ''; ?>" id="wp-mail-smtp-setting-row-email-heading">
|
166 |
<div class="wp-mail-smtp-setting-field">
|
167 |
<h2><?php echo $provider->get_title(); ?></h2>
|
168 |
<?php if ( ! empty( $provider_desc ) ) : ?>
|
@@ -197,6 +206,11 @@ class Settings extends PageAbstract {
|
|
197 |
$options = new Options();
|
198 |
$old_opt = $options->get_all();
|
199 |
|
|
|
|
|
|
|
|
|
|
|
200 |
$to_redirect = false;
|
201 |
|
202 |
// Old and new Gmail client id/secret values are different - we need to invalidate tokens and scroll to Auth button.
|
@@ -220,7 +234,7 @@ class Settings extends PageAbstract {
|
|
220 |
// New gmail clients data will be added from new $data, except the old access/refresh_token.
|
221 |
$to_save = array_merge( $old_opt, $data );
|
222 |
|
223 |
-
// All the sanitization is done
|
224 |
$options->set( $to_save );
|
225 |
|
226 |
if ( $to_redirect ) {
|
3 |
namespace WPMailSMTP\Admin\Pages;
|
4 |
|
5 |
use WPMailSMTP\Admin\PageAbstract;
|
6 |
+
use WPMailSMTP\Debug;
|
7 |
use WPMailSMTP\Options;
|
8 |
use WPMailSMTP\WP;
|
9 |
|
88 |
<input name="wp-mail-smtp[mail][from_name]" type="text"
|
89 |
value="<?php echo esc_attr( $options->get( 'mail', 'from_name' ) ); ?>"
|
90 |
<?php echo $options->is_const_defined( 'mail', 'from_name' ) ? 'disabled' : ''; ?>
|
91 |
+
id="wp-mail-smtp-setting-from_name" spellcheck="false"
|
92 |
/>
|
93 |
<p class="desc">
|
94 |
<?php esc_html_e( 'You can specify the name that emails should be sent from.', 'wp-mail-smtp' ); ?><br/>
|
113 |
|
114 |
<?php foreach ( wp_mail_smtp()->get_providers()->get_options_all() as $provider ) : ?>
|
115 |
|
116 |
+
<?php
|
117 |
+
if ( ! $options->is_pepipost_active() && $provider->get_slug() === 'pepipost' ) {
|
118 |
+
continue;
|
119 |
+
}
|
120 |
+
?>
|
121 |
+
|
122 |
<div class="wp-mail-smtp-mailer <?php echo $mailer === $provider->get_slug() ? 'active' : ''; ?>">
|
123 |
<div class="wp-mail-smtp-mailer-image">
|
124 |
<img src="<?php echo esc_url( $provider->get_logo_url() ); ?>"
|
153 |
<?php echo $options->is_const_defined( 'mail', 'return_path' ) ? 'disabled' : ''; ?>
|
154 |
id="wp-mail-smtp-setting-return_path"
|
155 |
/>
|
156 |
+
<label for="wp-mail-smtp-setting-return_path">
|
157 |
+
<?php esc_html_e( 'Set the return-path to match the From Email', 'wp-mail-smtp' ); ?>
|
158 |
+
</label>
|
159 |
<p class="desc">
|
160 |
<?php esc_html_e( 'Return Path indicates where non-delivery receipts - or bounce messages - are to be sent.', 'wp-mail-smtp' ); ?><br/>
|
161 |
<?php esc_html_e( 'If unchecked bounce messages may be lost.', 'wp-mail-smtp' ); ?>
|
171 |
|
172 |
<!-- Mailer Option Title -->
|
173 |
<?php $provider_desc = $provider->get_description(); ?>
|
174 |
+
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading <?php echo empty( $provider_desc ) ? 'no-desc' : ''; ?>" id="wp-mail-smtp-setting-row-email-heading">
|
175 |
<div class="wp-mail-smtp-setting-field">
|
176 |
<h2><?php echo $provider->get_title(); ?></h2>
|
177 |
<?php if ( ! empty( $provider_desc ) ) : ?>
|
206 |
$options = new Options();
|
207 |
$old_opt = $options->get_all();
|
208 |
|
209 |
+
// Remove all debug messages when switching mailers.
|
210 |
+
if ( $old_opt['mail']['mailer'] !== $data['mail']['mailer'] ) {
|
211 |
+
Debug::clear();
|
212 |
+
}
|
213 |
+
|
214 |
$to_redirect = false;
|
215 |
|
216 |
// Old and new Gmail client id/secret values are different - we need to invalidate tokens and scroll to Auth button.
|
234 |
// New gmail clients data will be added from new $data, except the old access/refresh_token.
|
235 |
$to_save = array_merge( $old_opt, $data );
|
236 |
|
237 |
+
// All the sanitization is done in Options class.
|
238 |
$options->set( $to_save );
|
239 |
|
240 |
if ( $to_redirect ) {
|
src/Admin/Pages/Test.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
namespace WPMailSMTP\Admin\Pages;
|
4 |
|
|
|
5 |
use WPMailSMTP\MailCatcher;
|
6 |
use WPMailSMTP\Options;
|
7 |
use WPMailSMTP\WP;
|
@@ -119,7 +120,7 @@ class Test extends PageAbstract {
|
|
119 |
$smtp_debug = ob_get_clean();
|
120 |
|
121 |
/*
|
122 |
-
*
|
123 |
*/
|
124 |
if ( $result ) {
|
125 |
WP::add_admin_notice(
|
@@ -130,8 +131,7 @@ class Test extends PageAbstract {
|
|
130 |
$error = $this->get_debug_messages( $phpmailer, $smtp_debug );
|
131 |
|
132 |
WP::add_admin_notice(
|
133 |
-
'<p><strong>' . esc_html__( 'There was a problem while sending a test email.', 'wp-mail-smtp' ) . '</strong></p>' .
|
134 |
-
'<p>' . esc_html__( 'The related debugging output is shown below:', 'wp-mail-smtp' ) . '</p>' .
|
135 |
'<blockquote style="border-left:1px solid orange;padding-left:10px">' . $error . '</blockquote>' .
|
136 |
'<p class="description">' . esc_html__( 'Please copy only the content of the error debug message above, identified with an orange left border, into the support forum topic if you experience any issues.', 'wp-mail-smtp' ) . '</p>',
|
137 |
WP::ADMIN_NOTICE_ERROR
|
@@ -144,7 +144,7 @@ class Test extends PageAbstract {
|
|
144 |
*
|
145 |
* @since 1.0.0
|
146 |
*
|
147 |
-
* @param
|
148 |
* @param string $smtp_debug
|
149 |
*
|
150 |
* @return string
|
@@ -168,68 +168,51 @@ class Test extends PageAbstract {
|
|
168 |
* Mailer Debug.
|
169 |
*/
|
170 |
|
171 |
-
$mailer_text = '<strong>
|
172 |
|
173 |
$mailer_text .= '<strong>Mailer:</strong> ' . $phpmailer->Mailer . '<br>';
|
|
|
174 |
|
175 |
// Display different debug info based on the mailer.
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
$mailer_text .=
|
180 |
-
$mailer_text .= '<strong>SMTPSecure:</strong> ' . $this->pvar( $phpmailer->SMTPSecure ) . '<br>';
|
181 |
-
$mailer_text .= '<strong>SMTPAutoTLS:</strong> ' . $this->pvar( $phpmailer->SMTPAutoTLS ) . '<br>';
|
182 |
-
$mailer_text .= '<strong>SMTPAuth:</strong> ' . $this->pvar( $phpmailer->SMTPAuth );
|
183 |
-
if ( ! empty( $phpmailer->SMTPOptions ) ) {
|
184 |
-
$mailer_text .= '<br><strong>SMTPOptions:</strong> <code>' . json_encode( $phpmailer->SMTPOptions ) . '</code>';
|
185 |
-
}
|
186 |
}
|
187 |
|
188 |
/*
|
189 |
-
*
|
190 |
*/
|
191 |
|
192 |
-
$
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
}
|
198 |
|
199 |
$errors = apply_filters( 'wp_mail_smtp_admin_test_get_debug_messages', array(
|
200 |
$versions_text,
|
201 |
$mailer_text,
|
|
|
202 |
$smtp_text,
|
203 |
) );
|
204 |
|
205 |
-
return '<pre>' . implode( '<br>', $errors ) . '</pre>';
|
206 |
-
}
|
207 |
-
|
208 |
-
/**
|
209 |
-
* Get the proper variable content output to debug.
|
210 |
-
*
|
211 |
-
* @since 1.0.0
|
212 |
-
*
|
213 |
-
* @param mixed $var
|
214 |
-
*
|
215 |
-
* @return string
|
216 |
-
*/
|
217 |
-
protected function pvar( $var = '' ) {
|
218 |
-
|
219 |
-
ob_start();
|
220 |
-
|
221 |
-
echo '<code>';
|
222 |
-
|
223 |
-
if ( is_bool( $var ) || empty( $var ) ) {
|
224 |
-
var_dump( $var );
|
225 |
-
} else {
|
226 |
-
print_r( $var );
|
227 |
-
}
|
228 |
-
|
229 |
-
echo '</code>';
|
230 |
-
|
231 |
-
$output = ob_get_clean();
|
232 |
-
|
233 |
-
return str_replace( array( "\r\n", "\r", "\n" ), '', $output );
|
234 |
}
|
235 |
}
|
2 |
|
3 |
namespace WPMailSMTP\Admin\Pages;
|
4 |
|
5 |
+
use WPMailSMTP\Debug;
|
6 |
use WPMailSMTP\MailCatcher;
|
7 |
use WPMailSMTP\Options;
|
8 |
use WPMailSMTP\WP;
|
120 |
$smtp_debug = ob_get_clean();
|
121 |
|
122 |
/*
|
123 |
+
* Notify a user about the results.
|
124 |
*/
|
125 |
if ( $result ) {
|
126 |
WP::add_admin_notice(
|
131 |
$error = $this->get_debug_messages( $phpmailer, $smtp_debug );
|
132 |
|
133 |
WP::add_admin_notice(
|
134 |
+
'<p><strong>' . esc_html__( 'There was a problem while sending a test email. Related debugging output is shown below:', 'wp-mail-smtp' ) . '</strong></p>' .
|
|
|
135 |
'<blockquote style="border-left:1px solid orange;padding-left:10px">' . $error . '</blockquote>' .
|
136 |
'<p class="description">' . esc_html__( 'Please copy only the content of the error debug message above, identified with an orange left border, into the support forum topic if you experience any issues.', 'wp-mail-smtp' ) . '</p>',
|
137 |
WP::ADMIN_NOTICE_ERROR
|
144 |
*
|
145 |
* @since 1.0.0
|
146 |
*
|
147 |
+
* @param MailCatcher $phpmailer
|
148 |
* @param string $smtp_debug
|
149 |
*
|
150 |
* @return string
|
168 |
* Mailer Debug.
|
169 |
*/
|
170 |
|
171 |
+
$mailer_text = '<strong>Params:</strong><br>';
|
172 |
|
173 |
$mailer_text .= '<strong>Mailer:</strong> ' . $phpmailer->Mailer . '<br>';
|
174 |
+
$mailer_text .= '<strong>Constants:</strong> ' . ( $options->is_const_enabled() ? 'Yes' : 'No' ) . '<br>';
|
175 |
|
176 |
// Display different debug info based on the mailer.
|
177 |
+
$mailer = wp_mail_smtp()->get_providers()->get_mailer( $options->get( 'mail', 'mailer' ), $phpmailer );
|
178 |
+
|
179 |
+
if ( $mailer ) {
|
180 |
+
$mailer_text .= $mailer->get_debug_info();
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
}
|
182 |
|
183 |
/*
|
184 |
+
* General Debug.
|
185 |
*/
|
186 |
|
187 |
+
$debug_text = implode( '<br>', Debug::get() );
|
188 |
+
Debug::clear();
|
189 |
+
if ( ! empty( $debug_text ) ) {
|
190 |
+
$debug_text = '<br><strong>Debug:</strong><br>' . $debug_text . '<br>';
|
191 |
+
}
|
192 |
+
|
193 |
+
/*
|
194 |
+
* SMTP Debug.
|
195 |
+
*/
|
196 |
+
|
197 |
+
$smtp_text = '';
|
198 |
+
if ( $options->is_mailer_smtp() ) {
|
199 |
+
$smtp_text = '<strong>SMTP Debug:</strong><br>';
|
200 |
+
if ( ! empty( $smtp_debug ) ) {
|
201 |
+
$smtp_text .= $smtp_debug;
|
202 |
+
} else {
|
203 |
+
$smtp_text .= '[empty]';
|
204 |
+
}
|
205 |
+
|
206 |
+
array_push( $errors, $smtp_text );
|
207 |
}
|
208 |
|
209 |
$errors = apply_filters( 'wp_mail_smtp_admin_test_get_debug_messages', array(
|
210 |
$versions_text,
|
211 |
$mailer_text,
|
212 |
+
$debug_text,
|
213 |
$smtp_text,
|
214 |
) );
|
215 |
|
216 |
+
return '<pre>' . implode( '<br>', array_filter( $errors ) ) . '</pre>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
}
|
218 |
}
|
src/Core.php
CHANGED
@@ -223,7 +223,7 @@ class Core {
|
|
223 |
// Store the plugin version activated to reference with upgrades.
|
224 |
update_option( 'wp_mail_smtp_version', WPMS_PLUGIN_VER );
|
225 |
|
226 |
-
// Create and store
|
227 |
$options['mail'] = array(
|
228 |
'from_email' => get_option( 'admin_email' ),
|
229 |
'from_name' => get_bloginfo( 'name' ),
|
223 |
// Store the plugin version activated to reference with upgrades.
|
224 |
update_option( 'wp_mail_smtp_version', WPMS_PLUGIN_VER );
|
225 |
|
226 |
+
// Create and store initial plugin settings.
|
227 |
$options['mail'] = array(
|
228 |
'from_email' => get_option( 'admin_email' ),
|
229 |
'from_name' => get_bloginfo( 'name' ),
|
src/Debug.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPMailSMTP;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class Debug that will save all errors or warnings generated by APIs or SMTP
|
7 |
+
* and display in area for administrators.
|
8 |
+
*
|
9 |
+
* Usage example:
|
10 |
+
* Debug::set( 'Some warning: %s', array( '%s' => $e->getMessage() );
|
11 |
+
* $debug = Debug::get(); // array
|
12 |
+
* $debug = Debug::get_last(); // string
|
13 |
+
*
|
14 |
+
* @since 1.2.0
|
15 |
+
*/
|
16 |
+
class Debug {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Key for options table where all messages will be saved to.
|
20 |
+
*/
|
21 |
+
const OPTION_KEY = 'wp_mail_smtp_debug';
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Save the debug message to a debug log.
|
25 |
+
* Adds one more to a list, at the end.
|
26 |
+
*
|
27 |
+
* @since 1.2.0
|
28 |
+
*
|
29 |
+
* @param string $message
|
30 |
+
*/
|
31 |
+
public static function set( $message ) {
|
32 |
+
|
33 |
+
if ( ! is_string( $message ) ) {
|
34 |
+
$message = \json_encode( $message );
|
35 |
+
}
|
36 |
+
|
37 |
+
$message = wp_strip_all_tags( $message, false );
|
38 |
+
|
39 |
+
$all = self::get();
|
40 |
+
|
41 |
+
array_push( $all, $message );
|
42 |
+
|
43 |
+
update_option( self::OPTION_KEY, $all, false );
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Remove all messages for a debug log.
|
48 |
+
*
|
49 |
+
* @since 1.2.0
|
50 |
+
*/
|
51 |
+
public static function clear() {
|
52 |
+
update_option( self::OPTION_KEY, array(), false );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Retrieve all messages from a debug log.
|
57 |
+
*
|
58 |
+
* @since 1.2.0
|
59 |
+
*
|
60 |
+
* @return array
|
61 |
+
*/
|
62 |
+
public static function get() {
|
63 |
+
|
64 |
+
$all = get_option( self::OPTION_KEY, array() );
|
65 |
+
|
66 |
+
if ( ! is_array( $all ) ) {
|
67 |
+
$all = (array) $all;
|
68 |
+
}
|
69 |
+
|
70 |
+
return $all;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Get the last message that was saved to a debug log.
|
75 |
+
*
|
76 |
+
* @since 1.2.0
|
77 |
+
*
|
78 |
+
* @return string
|
79 |
+
*/
|
80 |
+
public static function get_last() {
|
81 |
+
|
82 |
+
$all = self::get();
|
83 |
+
|
84 |
+
if ( ! empty( $all ) && is_array( $all ) ) {
|
85 |
+
return (string) $all[ count( $all ) - 1 ];
|
86 |
+
}
|
87 |
+
|
88 |
+
return '';
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Get the proper variable content output to debug.
|
93 |
+
*
|
94 |
+
* @since 1.2.0
|
95 |
+
*
|
96 |
+
* @param mixed $var
|
97 |
+
*
|
98 |
+
* @return string
|
99 |
+
*/
|
100 |
+
public static function pvar( $var = '' ) {
|
101 |
+
|
102 |
+
ob_start();
|
103 |
+
|
104 |
+
echo '<code>';
|
105 |
+
|
106 |
+
if ( is_bool( $var ) || empty( $var ) ) {
|
107 |
+
var_dump( $var );
|
108 |
+
} else {
|
109 |
+
print_r( $var );
|
110 |
+
}
|
111 |
+
|
112 |
+
echo '</code>';
|
113 |
+
|
114 |
+
$output = ob_get_clean();
|
115 |
+
|
116 |
+
return str_replace( array( "\r\n", "\r", "\n" ), '', $output );
|
117 |
+
}
|
118 |
+
}
|
src/Providers/Gmail/Auth.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
namespace WPMailSMTP\Providers\Gmail;
|
4 |
|
|
|
5 |
use WPMailSMTP\Options as PluginOptions;
|
6 |
use WPMailSMTP\Providers\AuthAbstract;
|
7 |
|
@@ -38,7 +39,12 @@ class Auth extends AuthAbstract {
|
|
38 |
|
39 |
$options = new PluginOptions();
|
40 |
$this->mailer = $options->get( 'mail', 'mailer' );
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
if ( $this->is_clients_saved() ) {
|
44 |
|
@@ -93,6 +99,7 @@ class Auth extends AuthAbstract {
|
|
93 |
$creds = $client->fetchAccessTokenWithAuthCode( $this->gmail['auth_code'] );
|
94 |
} catch ( \Exception $e ) {
|
95 |
$creds['error'] = $e->getMessage();
|
|
|
96 |
}
|
97 |
|
98 |
// Bail if we have an error.
|
@@ -121,11 +128,11 @@ class Auth extends AuthAbstract {
|
|
121 |
$creds = $client->fetchAccessTokenWithRefreshToken( $refresh );
|
122 |
} catch ( \Exception $e ) {
|
123 |
$creds['error'] = $e->getMessage();
|
|
|
124 |
}
|
125 |
|
126 |
// Bail if we have an error.
|
127 |
if ( ! empty( $creds['error'] ) ) {
|
128 |
-
// TODO: save this error to display to a user later.
|
129 |
return $client;
|
130 |
}
|
131 |
|
@@ -147,6 +154,7 @@ class Auth extends AuthAbstract {
|
|
147 |
|
148 |
// We can't process without saved client_id/secret.
|
149 |
if ( ! $this->is_clients_saved() ) {
|
|
|
150 |
wp_redirect(
|
151 |
add_query_arg(
|
152 |
'error',
|
@@ -266,7 +274,6 @@ class Auth extends AuthAbstract {
|
|
266 |
$all[ $this->mailer ]['auth_code'] = $code;
|
267 |
$this->gmail['auth_code'] = $code;
|
268 |
|
269 |
-
|
270 |
$options->set( $all );
|
271 |
}
|
272 |
|
2 |
|
3 |
namespace WPMailSMTP\Providers\Gmail;
|
4 |
|
5 |
+
use WPMailSMTP\Debug;
|
6 |
use WPMailSMTP\Options as PluginOptions;
|
7 |
use WPMailSMTP\Providers\AuthAbstract;
|
8 |
|
39 |
|
40 |
$options = new PluginOptions();
|
41 |
$this->mailer = $options->get( 'mail', 'mailer' );
|
42 |
+
|
43 |
+
if ( $this->mailer !== 'gmail' ) {
|
44 |
+
return;
|
45 |
+
}
|
46 |
+
|
47 |
+
$this->gmail = $options->get_group( $this->mailer );
|
48 |
|
49 |
if ( $this->is_clients_saved() ) {
|
50 |
|
99 |
$creds = $client->fetchAccessTokenWithAuthCode( $this->gmail['auth_code'] );
|
100 |
} catch ( \Exception $e ) {
|
101 |
$creds['error'] = $e->getMessage();
|
102 |
+
Debug::set( $e->getMessage() );
|
103 |
}
|
104 |
|
105 |
// Bail if we have an error.
|
128 |
$creds = $client->fetchAccessTokenWithRefreshToken( $refresh );
|
129 |
} catch ( \Exception $e ) {
|
130 |
$creds['error'] = $e->getMessage();
|
131 |
+
Debug::set( $e->getMessage() );
|
132 |
}
|
133 |
|
134 |
// Bail if we have an error.
|
135 |
if ( ! empty( $creds['error'] ) ) {
|
|
|
136 |
return $client;
|
137 |
}
|
138 |
|
154 |
|
155 |
// We can't process without saved client_id/secret.
|
156 |
if ( ! $this->is_clients_saved() ) {
|
157 |
+
Debug::set( 'There was an error while processing the Google authentication request. Please make sure that you have Client ID and Client Secret both valid and saved.' );
|
158 |
wp_redirect(
|
159 |
add_query_arg(
|
160 |
'error',
|
274 |
$all[ $this->mailer ]['auth_code'] = $code;
|
275 |
$this->gmail['auth_code'] = $code;
|
276 |
|
|
|
277 |
$options->set( $all );
|
278 |
}
|
279 |
|
src/Providers/Gmail/Mailer.php
CHANGED
@@ -2,7 +2,9 @@
|
|
2 |
|
3 |
namespace WPMailSMTP\Providers\Gmail;
|
4 |
|
|
|
5 |
use WPMailSMTP\Providers\MailerAbstract;
|
|
|
6 |
|
7 |
/**
|
8 |
* Class Mailer.
|
@@ -55,64 +57,22 @@ class Mailer extends MailerAbstract {
|
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
-
*
|
59 |
*
|
60 |
-
* @since 1.
|
61 |
-
*
|
62 |
-
* @param string $email
|
63 |
-
* @param string $name
|
64 |
-
*/
|
65 |
-
public function set_from( $email, $name ) {
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Set a bunch of email recipients: to, cc, bcc.
|
70 |
-
*
|
71 |
-
* @since 1.0.0
|
72 |
-
*
|
73 |
-
* @param array $recipients
|
74 |
-
*/
|
75 |
-
public function set_recipients( $recipients ) {
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Set the email content.
|
80 |
*
|
81 |
-
* @
|
82 |
-
*
|
83 |
-
* @param string|array $content
|
84 |
-
*/
|
85 |
-
public function set_content( $content ) {
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Set the email attachments.
|
90 |
-
*
|
91 |
-
* @since 1.0.0
|
92 |
-
*
|
93 |
-
* @param array $attachments
|
94 |
-
*/
|
95 |
-
public function set_attachments( $attachments ) {
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Set the email reply_to option.
|
100 |
-
*
|
101 |
-
* @since 1.0.0
|
102 |
-
*
|
103 |
-
* @param array $reply_to
|
104 |
*/
|
105 |
-
public function
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
-
|
109 |
-
* Set the email return_path (when supported).
|
110 |
-
*
|
111 |
-
* @since 1.0.0
|
112 |
-
*
|
113 |
-
* @param string $email
|
114 |
-
*/
|
115 |
-
public function set_return_path( $email ) {
|
116 |
}
|
117 |
|
118 |
/**
|
@@ -135,7 +95,8 @@ class Mailer extends MailerAbstract {
|
|
135 |
|
136 |
$this->process_response( $response );
|
137 |
} catch ( \Exception $e ) {
|
138 |
-
|
|
|
139 |
return;
|
140 |
}
|
141 |
}
|
@@ -170,4 +131,30 @@ class Mailer extends MailerAbstract {
|
|
170 |
|
171 |
return $is_sent;
|
172 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
}
|
2 |
|
3 |
namespace WPMailSMTP\Providers\Gmail;
|
4 |
|
5 |
+
use WPMailSMTP\Debug;
|
6 |
use WPMailSMTP\Providers\MailerAbstract;
|
7 |
+
use WPMailSMTP\WP;
|
8 |
|
9 |
/**
|
10 |
* Class Mailer.
|
57 |
}
|
58 |
|
59 |
/**
|
60 |
+
* Re-use the MailCatcher class methods and properties.
|
61 |
*
|
62 |
+
* @since 1.2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
*
|
64 |
+
* @param \WPMailSMTP\MailCatcher $phpmailer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
*/
|
66 |
+
public function process_phpmailer( $phpmailer ) {
|
67 |
+
// Make sure that we have access to MailCatcher class methods.
|
68 |
+
if (
|
69 |
+
! $phpmailer instanceof \WPMailSMTP\MailCatcher &&
|
70 |
+
! $phpmailer instanceof \PHPMailer
|
71 |
+
) {
|
72 |
+
return;
|
73 |
+
}
|
74 |
|
75 |
+
$this->phpmailer = $phpmailer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
/**
|
95 |
|
96 |
$this->process_response( $response );
|
97 |
} catch ( \Exception $e ) {
|
98 |
+
Debug::set( 'Error while sending via Gmail mailer: ' . $e->getMessage() );
|
99 |
+
|
100 |
return;
|
101 |
}
|
102 |
}
|
131 |
|
132 |
return $is_sent;
|
133 |
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* @inheritdoc
|
137 |
+
*/
|
138 |
+
public function get_debug_info() {
|
139 |
+
|
140 |
+
$gmail_text = array();
|
141 |
+
|
142 |
+
$options = new \WPMailSMTP\Options();
|
143 |
+
$gmail = $options->get_group( 'gmail' );
|
144 |
+
|
145 |
+
$gmail_text[] = '<strong>Client ID/Secret:</strong> ' . ( ! empty( $gmail['client_id'] ) && ! empty( $gmail['client_secret'] ) ? 'Yes' : 'No' );
|
146 |
+
$gmail_text[] = '<strong>Auth Code:</strong> ' . ( ! empty( $gmail['auth_code'] ) ? 'Yes' : 'No' );
|
147 |
+
$gmail_text[] = '<strong>Access Token:</strong> ' . ( ! empty( $gmail['access_token'] ) ? 'Yes' : 'No' );
|
148 |
+
|
149 |
+
$gmail_text[] = '<br><strong>Server:</strong>';
|
150 |
+
|
151 |
+
$gmail_text[] = '<strong>OpenSSL:</strong> ' . ( extension_loaded( 'openssl' ) ? 'Yes' : 'No' );
|
152 |
+
$gmail_text[] = '<strong>PHP.allow_url_fopen:</strong> ' . ( ini_get( 'allow_url_fopen' ) ? 'Yes' : 'No' );
|
153 |
+
$gmail_text[] = '<strong>PHP.stream_socket_client():</strong> ' . ( function_exists( 'stream_socket_client' ) ? 'Yes' : 'No' );
|
154 |
+
$gmail_text[] = '<strong>PHP.fsockopen():</strong> ' . ( function_exists( 'fsockopen' ) ? 'Yes' : 'No' );
|
155 |
+
$gmail_text[] = '<strong>PHP.curl_version():</strong> ' . ( function_exists( 'curl_version' ) ? 'Yes' : 'No' );
|
156 |
+
$gmail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', apache_get_modules(), true ) || in_array( 'mod_security2', apache_get_modules(), true ) ? 'Yes' : 'No' );
|
157 |
+
|
158 |
+
return implode( '<br>', $gmail_text );
|
159 |
+
}
|
160 |
}
|
src/Providers/Gmail/Options.php
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
|
3 |
namespace WPMailSMTP\Providers\Gmail;
|
4 |
|
5 |
-
use WPMailSMTP\Providers\
|
6 |
|
7 |
/**
|
8 |
* Class Option.
|
9 |
*
|
10 |
* @since 1.0.0
|
11 |
*/
|
12 |
-
class Options extends
|
13 |
|
14 |
/**
|
15 |
* Mailgun constructor.
|
2 |
|
3 |
namespace WPMailSMTP\Providers\Gmail;
|
4 |
|
5 |
+
use WPMailSMTP\Providers\OptionsAbstract;
|
6 |
|
7 |
/**
|
8 |
* Class Option.
|
9 |
*
|
10 |
* @since 1.0.0
|
11 |
*/
|
12 |
+
class Options extends OptionsAbstract {
|
13 |
|
14 |
/**
|
15 |
* Mailgun constructor.
|
src/Providers/Loader.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
namespace WPMailSMTP\Providers;
|
4 |
|
|
|
5 |
use WPMailSMTP\MailCatcher;
|
6 |
|
7 |
/**
|
@@ -67,7 +68,7 @@ class Loader {
|
|
67 |
*
|
68 |
* @param string $provider
|
69 |
*
|
70 |
-
* @return \WPMailSMTP\Providers\
|
71 |
*/
|
72 |
public function get_options( $provider ) {
|
73 |
return $this->get_entity( $provider, 'Options' );
|
@@ -78,7 +79,7 @@ class Loader {
|
|
78 |
*
|
79 |
* @since 1.0.0
|
80 |
*
|
81 |
-
* @return \WPMailSMTP\Providers\
|
82 |
*/
|
83 |
public function get_options_all() {
|
84 |
$options = array();
|
@@ -87,7 +88,7 @@ class Loader {
|
|
87 |
|
88 |
$option = $this->get_options( $provider );
|
89 |
|
90 |
-
if ( ! $option instanceof
|
91 |
continue;
|
92 |
}
|
93 |
|
@@ -116,7 +117,10 @@ class Loader {
|
|
116 |
*/
|
117 |
public function get_mailer( $provider, $phpmailer ) {
|
118 |
|
119 |
-
if (
|
|
|
|
|
|
|
120 |
$this->phpmailer = $phpmailer;
|
121 |
}
|
122 |
|
@@ -169,7 +173,7 @@ class Loader {
|
|
169 |
}
|
170 |
}
|
171 |
} catch ( \Exception $e ) {
|
172 |
-
|
173 |
$entity = null;
|
174 |
}
|
175 |
|
2 |
|
3 |
namespace WPMailSMTP\Providers;
|
4 |
|
5 |
+
use WPMailSMTP\Debug;
|
6 |
use WPMailSMTP\MailCatcher;
|
7 |
|
8 |
/**
|
68 |
*
|
69 |
* @param string $provider
|
70 |
*
|
71 |
+
* @return \WPMailSMTP\Providers\OptionsAbstract|null
|
72 |
*/
|
73 |
public function get_options( $provider ) {
|
74 |
return $this->get_entity( $provider, 'Options' );
|
79 |
*
|
80 |
* @since 1.0.0
|
81 |
*
|
82 |
+
* @return \WPMailSMTP\Providers\OptionsAbstract[]
|
83 |
*/
|
84 |
public function get_options_all() {
|
85 |
$options = array();
|
88 |
|
89 |
$option = $this->get_options( $provider );
|
90 |
|
91 |
+
if ( ! $option instanceof OptionsAbstract ) {
|
92 |
continue;
|
93 |
}
|
94 |
|
117 |
*/
|
118 |
public function get_mailer( $provider, $phpmailer ) {
|
119 |
|
120 |
+
if (
|
121 |
+
$phpmailer instanceof MailCatcher ||
|
122 |
+
$phpmailer instanceof \PHPMailer
|
123 |
+
) {
|
124 |
$this->phpmailer = $phpmailer;
|
125 |
}
|
126 |
|
173 |
}
|
174 |
}
|
175 |
} catch ( \Exception $e ) {
|
176 |
+
Debug::set( "There was a problem while retrieving {$request} for {$provider}: {$e->getMessage()}" );
|
177 |
$entity = null;
|
178 |
}
|
179 |
|
src/Providers/Mail/Mailer.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPMailSMTP\Providers\Mail;
|
4 |
+
|
5 |
+
use WPMailSMTP\Providers\MailerAbstract;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class Mailer inherits everything from parent abstract class.
|
9 |
+
* This file is required for a proper work of Loader and \ReflectionClass.
|
10 |
+
*
|
11 |
+
* @package WPMailSMTP\Providers\Mail
|
12 |
+
*/
|
13 |
+
class Mailer extends MailerAbstract {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @inheritdoc
|
17 |
+
*/
|
18 |
+
public function get_debug_info() {
|
19 |
+
|
20 |
+
$mail_text = array();
|
21 |
+
|
22 |
+
$mail_text[] = '<br><strong>Server:</strong>';
|
23 |
+
|
24 |
+
$disabled_functions = ini_get( 'disable_functions' );
|
25 |
+
$disabled = (array) explode( ',', trim( $disabled_functions ) );
|
26 |
+
|
27 |
+
$mail_text[] = '<strong>PHP.mail():</strong> ' . ( in_array( 'mail', $disabled, true ) || ! function_exists( 'mail' ) ? 'No' : 'Yes' );
|
28 |
+
$mail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', apache_get_modules(), true ) || in_array( 'mod_security2', apache_get_modules(), true ) ? 'Yes' : 'No' );
|
29 |
+
|
30 |
+
return implode( '<br>', $mail_text );
|
31 |
+
}
|
32 |
+
}
|
src/Providers/Mail/Options.php
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
|
3 |
namespace WPMailSMTP\Providers\Mail;
|
4 |
|
5 |
-
use WPMailSMTP\Providers\
|
6 |
|
7 |
/**
|
8 |
* Class Option.
|
9 |
*
|
10 |
* @since 1.0.0
|
11 |
*/
|
12 |
-
class Options extends
|
13 |
|
14 |
/**
|
15 |
* Mail constructor.
|
2 |
|
3 |
namespace WPMailSMTP\Providers\Mail;
|
4 |
|
5 |
+
use WPMailSMTP\Providers\OptionsAbstract;
|
6 |
|
7 |
/**
|
8 |
* Class Option.
|
9 |
*
|
10 |
* @since 1.0.0
|
11 |
*/
|
12 |
+
class Options extends OptionsAbstract {
|
13 |
|
14 |
/**
|
15 |
* Mail constructor.
|
src/Providers/MailerAbstract.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
namespace WPMailSMTP\Providers;
|
4 |
|
|
|
5 |
use WPMailSMTP\MailCatcher;
|
6 |
use WPMailSMTP\Options;
|
7 |
|
@@ -76,10 +77,13 @@ abstract class MailerAbstract implements MailerInterface {
|
|
76 |
*
|
77 |
* @param MailCatcher $phpmailer
|
78 |
*/
|
79 |
-
|
80 |
|
81 |
-
// Make sure that we have access to
|
82 |
-
if (
|
|
|
|
|
|
|
83 |
return;
|
84 |
}
|
85 |
|
@@ -232,11 +236,17 @@ abstract class MailerAbstract implements MailerInterface {
|
|
232 |
protected function process_response( $response ) {
|
233 |
|
234 |
if ( is_wp_error( $response ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
return;
|
236 |
}
|
237 |
|
238 |
if ( isset( $response['body'] ) && $this->is_json( $response['body'] ) ) {
|
239 |
-
$response['body'] = json_decode( $response['body'] );
|
240 |
}
|
241 |
|
242 |
$this->response = $response;
|
@@ -267,11 +277,28 @@ abstract class MailerAbstract implements MailerInterface {
|
|
267 |
|
268 |
if ( wp_remote_retrieve_response_code( $this->response ) === $this->email_sent_code ) {
|
269 |
$is_sent = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
}
|
271 |
|
272 |
return apply_filters( 'wp_mail_smtp_providers_mailer_is_email_sent', $is_sent );
|
273 |
}
|
274 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
/**
|
276 |
* @inheritdoc
|
277 |
*/
|
@@ -343,4 +370,33 @@ abstract class MailerAbstract implements MailerInterface {
|
|
343 |
|
344 |
return $merged;
|
345 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
}
|
2 |
|
3 |
namespace WPMailSMTP\Providers;
|
4 |
|
5 |
+
use WPMailSMTP\Debug;
|
6 |
use WPMailSMTP\MailCatcher;
|
7 |
use WPMailSMTP\Options;
|
8 |
|
77 |
*
|
78 |
* @param MailCatcher $phpmailer
|
79 |
*/
|
80 |
+
public function process_phpmailer( $phpmailer ) {
|
81 |
|
82 |
+
// Make sure that we have access to MailCatcher class methods.
|
83 |
+
if (
|
84 |
+
! $phpmailer instanceof MailCatcher &&
|
85 |
+
! $phpmailer instanceof \PHPMailer
|
86 |
+
) {
|
87 |
return;
|
88 |
}
|
89 |
|
236 |
protected function process_response( $response ) {
|
237 |
|
238 |
if ( is_wp_error( $response ) ) {
|
239 |
+
// Save the error text.
|
240 |
+
$errors = $response->get_error_messages();
|
241 |
+
foreach ( $errors as $error ) {
|
242 |
+
Debug::set( $error );
|
243 |
+
}
|
244 |
+
|
245 |
return;
|
246 |
}
|
247 |
|
248 |
if ( isset( $response['body'] ) && $this->is_json( $response['body'] ) ) {
|
249 |
+
$response['body'] = \json_decode( $response['body'] );
|
250 |
}
|
251 |
|
252 |
$this->response = $response;
|
277 |
|
278 |
if ( wp_remote_retrieve_response_code( $this->response ) === $this->email_sent_code ) {
|
279 |
$is_sent = true;
|
280 |
+
} else {
|
281 |
+
$error = $this->get_response_error();
|
282 |
+
|
283 |
+
if ( ! empty( $error ) ) {
|
284 |
+
Debug::set( $error );
|
285 |
+
}
|
286 |
}
|
287 |
|
288 |
return apply_filters( 'wp_mail_smtp_providers_mailer_is_email_sent', $is_sent );
|
289 |
}
|
290 |
|
291 |
+
/**
|
292 |
+
* Should be overwritten when appropriate.
|
293 |
+
*
|
294 |
+
* @since 1.2.0
|
295 |
+
*
|
296 |
+
* @return string
|
297 |
+
*/
|
298 |
+
protected function get_response_error() {
|
299 |
+
return '';
|
300 |
+
}
|
301 |
+
|
302 |
/**
|
303 |
* @inheritdoc
|
304 |
*/
|
370 |
|
371 |
return $merged;
|
372 |
}
|
373 |
+
|
374 |
+
/**
|
375 |
+
* This method is relevant to SMTP, Pepipost and Mail.
|
376 |
+
* All other custom mailers should override it with own information.
|
377 |
+
*
|
378 |
+
* @since 1.2.0
|
379 |
+
*
|
380 |
+
* @return string
|
381 |
+
*/
|
382 |
+
public function get_debug_info() {
|
383 |
+
global $phpmailer;
|
384 |
+
|
385 |
+
$smtp_text = array();
|
386 |
+
|
387 |
+
// Mail mailer has nothing to return.
|
388 |
+
if ( $this->options->is_mailer_smtp() ) {
|
389 |
+
$smtp_text[] = '<strong>ErrorInfo:</strong> ' . make_clickable( $phpmailer->ErrorInfo );
|
390 |
+
$smtp_text[] = '<strong>Host:</strong> ' . $phpmailer->Host;
|
391 |
+
$smtp_text[] = '<strong>Port:</strong> ' . $phpmailer->Port;
|
392 |
+
$smtp_text[] = '<strong>SMTPSecure:</strong> ' . Debug::pvar( $phpmailer->SMTPSecure );
|
393 |
+
$smtp_text[] = '<strong>SMTPAutoTLS:</strong> ' . Debug::pvar( $phpmailer->SMTPAutoTLS );
|
394 |
+
$smtp_text[] = '<strong>SMTPAuth:</strong> ' . Debug::pvar( $phpmailer->SMTPAuth );
|
395 |
+
if ( ! empty( $phpmailer->SMTPOptions ) ) {
|
396 |
+
$smtp_text[] = '<strong>SMTPOptions:</strong> <code>' . json_encode( $phpmailer->SMTPOptions ) . '</code>';
|
397 |
+
}
|
398 |
+
}
|
399 |
+
|
400 |
+
return implode( '<br>', $smtp_text );
|
401 |
+
}
|
402 |
}
|
src/Providers/MailerInterface.php
CHANGED
@@ -37,103 +37,38 @@ interface MailerInterface {
|
|
37 |
public function is_php_compatible();
|
38 |
|
39 |
/**
|
40 |
-
*
|
41 |
-
*
|
42 |
-
* @since 1.0.0
|
43 |
-
*
|
44 |
-
* @param array $headers
|
45 |
-
*/
|
46 |
-
public function set_headers( $headers );
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Set the email single header.
|
50 |
-
*
|
51 |
-
* @since 1.0.0
|
52 |
-
*
|
53 |
-
* @param string $name
|
54 |
-
* @param string $value
|
55 |
-
*/
|
56 |
-
public function set_header( $name, $value );
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Set email FROM.
|
60 |
-
*
|
61 |
-
* @since 1.0.0
|
62 |
-
*
|
63 |
-
* @param string $email
|
64 |
-
* @param string $name
|
65 |
-
*/
|
66 |
-
public function set_from( $email, $name );
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Set a bunch of email recipients: to, cc, bcc.
|
70 |
-
*
|
71 |
-
* @since 1.0.0
|
72 |
-
*
|
73 |
-
* @param array $recipients
|
74 |
-
*/
|
75 |
-
public function set_recipients( $recipients );
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Set the email subject.
|
79 |
-
*
|
80 |
-
* @since 1.0.0
|
81 |
-
*
|
82 |
-
* @param string $subject
|
83 |
-
*/
|
84 |
-
public function set_subject( $subject );
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Set the email content.
|
88 |
-
*
|
89 |
-
* @since 1.0.0
|
90 |
-
*
|
91 |
-
* @param string|array $content
|
92 |
-
*/
|
93 |
-
public function set_content( $content );
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Set the email attachments.
|
97 |
-
*
|
98 |
-
* @since 1.0.0
|
99 |
-
*
|
100 |
-
* @param array $attachments
|
101 |
-
*/
|
102 |
-
public function set_attachments( $attachments );
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Set the email reply_to option.
|
106 |
*
|
107 |
* @since 1.0.0
|
108 |
*
|
109 |
-
* @
|
110 |
*/
|
111 |
-
public function
|
112 |
|
113 |
/**
|
114 |
-
*
|
115 |
*
|
116 |
* @since 1.0.0
|
117 |
*
|
118 |
-
* @
|
119 |
*/
|
120 |
-
public function
|
121 |
|
122 |
/**
|
123 |
-
* Get the
|
124 |
*
|
125 |
-
* @since 1.
|
126 |
*
|
127 |
-
* @return
|
128 |
*/
|
129 |
-
public function
|
130 |
|
131 |
/**
|
132 |
-
*
|
133 |
*
|
134 |
-
* @since 1.
|
135 |
*
|
136 |
-
* @
|
137 |
*/
|
138 |
-
public function
|
139 |
}
|
37 |
public function is_php_compatible();
|
38 |
|
39 |
/**
|
40 |
+
* Get the email body.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
*
|
42 |
* @since 1.0.0
|
43 |
*
|
44 |
+
* @return string|array
|
45 |
*/
|
46 |
+
public function get_body();
|
47 |
|
48 |
/**
|
49 |
+
* Get the email headers.
|
50 |
*
|
51 |
* @since 1.0.0
|
52 |
*
|
53 |
+
* @return array
|
54 |
*/
|
55 |
+
public function get_headers();
|
56 |
|
57 |
/**
|
58 |
+
* Get an array of all debug information relevant to the mailer.
|
59 |
*
|
60 |
+
* @since 1.2.0
|
61 |
*
|
62 |
+
* @return array
|
63 |
*/
|
64 |
+
public function get_debug_info();
|
65 |
|
66 |
/**
|
67 |
+
* Re-use the MailCatcher class methods and properties.
|
68 |
*
|
69 |
+
* @since 1.2.0
|
70 |
*
|
71 |
+
* @param \WPMailSMTP\MailCatcher $phpmailer
|
72 |
*/
|
73 |
+
public function process_phpmailer( $phpmailer );
|
74 |
}
|
src/Providers/Mailgun/Mailer.php
CHANGED
@@ -30,7 +30,7 @@ class Mailer extends MailerAbstract {
|
|
30 |
*/
|
31 |
public function __construct( $phpmailer ) {
|
32 |
|
33 |
-
// We want to prefill everything from \
|
34 |
parent::__construct( $phpmailer );
|
35 |
|
36 |
/*
|
@@ -296,4 +296,43 @@ class Mailer extends MailerAbstract {
|
|
296 |
)
|
297 |
);
|
298 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
}
|
30 |
*/
|
31 |
public function __construct( $phpmailer ) {
|
32 |
|
33 |
+
// We want to prefill everything from \WPMailSMTP\MailCatcher class, which extends \PHPMailer.
|
34 |
parent::__construct( $phpmailer );
|
35 |
|
36 |
/*
|
296 |
)
|
297 |
);
|
298 |
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Get a Mailgun-specific response with a helpful error.
|
302 |
+
*
|
303 |
+
* @since 1.2.0
|
304 |
+
*
|
305 |
+
* @return string
|
306 |
+
*/
|
307 |
+
protected function get_response_error() {
|
308 |
+
|
309 |
+
$body = (array) wp_remote_retrieve_body( $this->response );
|
310 |
+
|
311 |
+
$error_text = array();
|
312 |
+
|
313 |
+
if ( ! empty( $body['message'] ) ) {
|
314 |
+
if ( ! is_string( $body['message'] ) ) {
|
315 |
+
$error_text[] = \json_encode( $body['message'] );
|
316 |
+
} else {
|
317 |
+
$error_text[] = $body['message'];
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
return implode( '<br>', $error_text );
|
322 |