WP Mail SMTP by WPForms - Version 1.2.0

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 Icon 128x128 WP Mail SMTP by WPForms
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 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:57
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&lt;email@domain.com&gt; in this field."
59
msgstr ""
60
61
- #: wp_mail_smtp.php:315, src/Admin/Pages/Settings.php:84
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:108
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:141
90
msgid "Return Path"
91
msgstr ""
92
93
- #: wp_mail_smtp.php:381, src/Admin/Pages/Settings.php:149
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:151
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/OptionAbstract.php:126
122
msgid "SMTP Host"
123
msgstr ""
124
125
- #: wp_mail_smtp.php:433, wp_mail_smtp.php:551, src/Providers/OptionAbstract.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/OptionAbstract.php:154
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/OptionAbstract.php:216
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:48
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:25
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\">&#9733;&#9733;&#9733;&#9733;&#9733;</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/OptionAbstract.php:164
230
msgid "None"
231
msgstr ""
232
233
- #: src/Providers/OptionAbstract.php:173
234
msgid "SSL"
235
msgstr ""
236
237
- #: src/Providers/OptionAbstract.php:182
238
msgid "TLS"
239
msgstr ""
240
241
- #: src/Providers/OptionAbstract.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/OptionAbstract.php:194
246
msgid "Auto TLS"
247
msgstr ""
248
249
- #: src/Providers/OptionAbstract.php:204, src/Providers/OptionAbstract.php:226
250
msgid "On"
251
msgstr ""
252
253
- #: src/Providers/OptionAbstract.php:205, src/Providers/OptionAbstract.php:227
254
msgid "Off"
255
msgstr ""
256
257
- #: src/Providers/OptionAbstract.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/OptionAbstract.php:235
262
msgid "SMTP Username"
263
msgstr ""
264
265
- #: src/Providers/OptionAbstract.php:249
266
msgid "SMTP Password"
267
msgstr ""
268
269
- #: src/Providers/OptionAbstract.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/OptionAbstract.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/OptionAbstract.php:307
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:182
290
msgid "Save Settings"
291
msgstr ""
292
293
- #: src/Admin/Pages/Misc.php:95, src/Admin/Pages/Settings.php:232
294
msgid "Settings were successfully saved."
295
msgstr ""
296
297
- #: src/Admin/Pages/Settings.php:50
298
msgid "Mail"
299
msgstr ""
300
301
- #: src/Admin/Pages/Settings.php:66
302
msgid "You can specify the email address that emails should be sent from."
303
msgstr ""
304
305
- #: src/Admin/Pages/Settings.php:70
306
msgid "If you leave this blank, the default one will be used: %s."
307
msgstr ""
308
309
- #: src/Admin/Pages/Settings.php:76
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:93
314
msgid "You can specify the name that emails should be sent from."
315
msgstr ""
316
317
- #: src/Admin/Pages/Settings.php:97
318
msgid "If you leave this blank, the emails will be sent from %s."
319
msgstr ""
320
321
- #: src/Admin/Pages/Settings.php:152
322
msgid "If unchecked bounce messages may be lost."
323
msgstr ""
324
325
- #: src/Admin/Pages/Test.php:26
326
msgid "Email Test"
327
msgstr ""
328
329
- #: src/Admin/Pages/Test.php:55
330
msgid "Send To"
331
msgstr ""
332
333
- #: src/Admin/Pages/Test.php:60
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:66
338
msgid "Send Email"
339
msgstr ""
340
341
- #: src/Admin/Pages/Test.php:86
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:110
346
msgid "Test email to %s"
347
msgstr ""
348
349
- #: src/Admin/Pages/Test.php:113
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:126
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 "The related debugging output is shown below:"
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&lt;email@domain.com&gt; 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\">&#9733;&#9733;&#9733;&#9733;&#9733;</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.1.0 - 2017-12-18 =
150
- * Added: New option "Auto TLS" for SMTP mailer. Default is enabled. Migration routine for all sites.
151
- * Changed: Improve debug output - clear styles and context-aware content.
152
- * Changed: Better exceptions handling for Google authentication process.
153
- * Changed: Do not sanitize passwords, api keys etc - as they may contain special characters in certain order and sanitization will break those values.
154
- * Changed: Improve wording of some helpful texts inside plugin admin area.
155
- * 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.
156
- * Fixed: Constants usage is working now, to define the SMTP password, for example.
157
- * Fixed: Notice for default mailer.
158
-
159
- = 1.0.2 - 2017-12-12 =
160
- * Fixed: PHPMailer using incorrect SMTPSecure value.
161
-
162
- = 1.0.1 - 2017-12-12 =
163
- * Fixed: Global POST processing conflict.
164
-
165
- = 1.0.0 - 2017-12-12 =
166
- * Added: Automatic migration tool to move options from older storage format to a new one.
167
- * Added: Added Gmail & G Suite email provider integration - without your email and password.
168
- * Added: Added SendGrid email provider integration - using the API key only.
169
- * Added: Added Mailgun email provider integration - using the API key and configured domain only.
170
- * 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.
171
- * Changed: The new look of the admin area.
172
- * Changed: SMTP password field now has "password" type.
173
- * Changed: SMTP password field does not display real password at all when using constants in `wp-config.php` to define it.
174
- * Changed: Escape properly all translations.
175
- * Changed: More helpful test email content (with a mailer name).
176
-
177
- = 0.11.2 - 2017-11-28 =
178
- * Added: Setting to hide announcement feed.
179
- * Changed: Announcement feed data.
180
-
181
- = 0.11.1 - 2017-10-30 =
182
- * Fixed: Older PHP compatibility fix.
183
-
184
- = 0.11 - 2017-10-30 =
185
- * Added: Helper description to Return Path option.
186
- * Added: Filter `wp_mail_smtp_admin_test_email_smtp_debug` to increase the debug message verbosity.
187
- * Added: PHP 5.2 notice.
188
- * Added: Announcement feed.
189
- * Changed: Localization fixes, proper locale name.
190
- * Changed: Code style improvements and optimizations for both HTML and PHP.
191
- * Changed: Inputs for emails now have a proper type `email`, instead of a generic `text`.
192
- * Changed: Turn off `$phpmailer->SMTPAutoTLS` when `No encryption` option is set to prevent error while sending emails.
193
- * Changed: Hide Pepipost for those who are not using it.
194
- * Changed: WP CLI support improved.
195
-
196
- = 0.10.1 =
197
- * Addition of Pepipost and cleanup of admin page.
198
-
199
- = 0.10.0 =
200
- * Addition of Pepipost and cleanup of admin page.
201
-
202
- = 0.9.6 =
203
- * Minor security fix, sanitize test email address.
204
-
205
- = 0.9.5 =
206
- * Minor security fix, hat tip JD Grimes.
207
-
208
- = 0.9.4 =
209
- * Improvement to the test email function, very low priority update.
210
-
211
- = 0.9.3 =
212
- * Fixing reported issue with passing by reference. props Adam Conway
213
-
214
- = 0.9.2 =
215
- * Removing the deprecation notice.
216
-
217
- = 0.9.1 =
218
- * $phpmailer->language became protected in WP 3.2, no longer unset on debug output.
219
-
220
- = 0.9.0 =
221
- * Typo in the From email description.
222
- * Removed changelog from plugin file, no need to duplicate it.
223
- * Optionally set $phpmailer->Sender from from email, helps with sendmail / mail().
224
-
225
- = 0.8.7 =
226
- * Fix for a long standing bug that caused an error during plugin activation.
227
-
228
- = 0.8.6 =
229
- * The Settings link really does work this time, promise. Apologies for the unnecessary updates.
230
-
231
- = 0.8.5 =
232
- * Bugfix, the settings link on the Plugin page was broken by 0.8.4.
233
-
234
- = 0.8.4 =
235
- * Minor bugfix, remove use of esc_html() to improve backwards compatibility.
236
- * Removed second options page menu props ovidiu.
237
-
238
- = 0.8.3 =
239
- * Bugfix, return WPMS_MAIL_FROM_NAME, props nacin.
240
- * Add Settings link, props Mike Challis http://profiles.wordpress.org/MikeChallis/
241
-
242
- = 0.8.2 =
243
- * Bugfix, call phpmailer_init_smtp() correctly, props Sinklar.
244
-
245
- = 0.8.1 =
246
- * Internationalisation improvements.
247
-
248
- = 0.8 =
249
- * Added port, SSL/TLS, option whitelisting, validate_email(), and constant options.
250
-
251
- = 0.7 =
252
- * Added checks to only override the default from name / email
253
-
254
- = 0.6 =
255
- * Added additional SMTP debugging output
256
-
257
- = 0.5.2 =
258
- * Fixed a pre 2.3 bug to do with mail from
259
-
260
- = 0.5.1 =
261
- * Added a check to display a warning on versions prior to 2.3
262
-
263
- = 0.5.0 =
264
- * Upgraded to match 2.3 filters which add a second filter for from name
265
-
266
- = 0.4.2 =
267
- * Fixed a bug in 0.4.1 and added more debugging output
268
-
269
- = 0.4.1 =
270
- * Added $phpmailer->ErroInfo to the test mail output
271
-
272
- = 0.4 =
273
- * Added the test email feature and cleaned up some other bits and pieces
274
-
275
- = 0.3.2 =
276
- * Changed to use register_activation_hook for greater compatability
277
-
278
- = 0.3.1 =
279
- * Added readme for WP-Plugins.org compatability
280
-
281
- = 0.3 =
282
- * Various bugfixes and added From options
283
-
284
- = 0.2 =
285
- * Reworked approach as suggested by westi, added options page
286
-
287
- = 0.1 =
288
- * Initial approach, copying the wp_mail function and replacing it
289
-
290
- == Upgrade Notice ==
291
-
292
- = 0.10.1 =
293
- Addition of Pepipost and cleanup of admin page.
294
-
295
- = 0.10.0 =
296
- Addition of Pepipost and cleanup of admin page.
297
-
298
- = 0.9.6 =
299
- Minor security fix, sanitize test email address.
300
-
301
- = 0.9.5 =
302
- Minor security fix, hat tip JD Grimes.
303
-
304
- = 0.9.4 =
305
- Improvement to the test email function, very low priority update.
306
-
307
- = 0.9.3 =
308
- Fixing reported issue with passing by reference.
309
-
310
- = 0.9.2 =
311
- Removing the deprecation notice.
312
-
313
- = 0.9.1 =
314
- Test mail functionality was broken on upgrade to 3.2, now restored.
315
-
316
- = 0.9.0 =
317
- Low priority upgrade. Improves the appearance of the options page.
318
-
319
- = 0.8.7 =
320
- Very low priority update. Fixes a bug that causes a spurious error during activation.
321
-
322
- = 0.8.6 =
323
- Low priority update. The Settings link was still broken in 0.8.5.
324
-
325
- = 0.8.5 =
326
- Minor bugfix correcting the Settings link bug introduced in 0.8.4. Very low priority update.
327
-
328
- = 0.8.4 =
329
- Minor bugfix for users using constants. Another very low priority upgrade. Apologies for the version creep.
330
-
331
- = 0.8.3 =
332
- Minor bugfix for users using constants. Very low priority upgrade.
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->process();
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-from-name" spellcheck="false"
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"><?php esc_html_e( 'Set the return-path to match the From Email', 'wp-mail-smtp' ); ?></label></label>
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 there.
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
- * Do the actual sending.
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 \PHPMailer $phpmailer
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>PHPMailer:</strong><br>';
172
173
$mailer_text .= '<strong>Mailer:</strong> ' . $phpmailer->Mailer . '<br>';
174
175
// Display different debug info based on the mailer.
176
- if ( $options->is_mailer_smtp() ) {
177
- $mailer_text .= '<strong>ErrorInfo:</strong> ' . make_clickable( $phpmailer->ErrorInfo ) . '<br>';
178
- $mailer_text .= '<strong>Host:</strong> ' . $phpmailer->Host . '<br>';
179
- $mailer_text .= '<strong>Port:</strong> ' . $phpmailer->Port . '<br>';
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
- * SMTP Debug.
190
*/
191
192
- $smtp_text = '<br><strong>SMTP Debug:</strong><br>';
193
- if ( ! empty( $smtp_debug ) ) {
194
- $smtp_text .= $smtp_debug;
195
- } else {
196
- $smtp_text .= '[empty]';
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 inital plugin settings.
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
- $this->gmail = $options->get_group( $this->mailer );
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
- * Set email FROM.
59
*
60
- * @since 1.0.0
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
- * @since 1.0.0
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 set_reply_to( $reply_to ) {
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
- // TODO: save here the error message to display to a user later.
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\OptionAbstract;
6
7
/**
8
* Class Option.
9
*
10
* @since 1.0.0
11
*/
12
- class Options extends OptionAbstract {
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\OptionAbstract|null
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\OptionAbstract[]
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 OptionAbstract ) {
91
continue;
92
}
93
@@ -116,7 +117,10 @@ class Loader {
116
*/
117
public function get_mailer( $provider, $phpmailer ) {
118
119
- if ( $phpmailer instanceof MailCatcher ) {
120
$this->phpmailer = $phpmailer;
121
}
122
@@ -169,7 +173,7 @@ class Loader {
169
}
170
}
171
} catch ( \Exception $e ) {
172
- // TODO: save error message later to display a user.
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\OptionAbstract;
6
7
/**
8
* Class Option.
9
*
10
* @since 1.0.0
11
*/
12
- class Options extends OptionAbstract {
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
- protected function process_phpmailer( $phpmailer ) {
80
81
- // Make sure that we have access to PHPMailer class methods.
82
- if ( ! $phpmailer instanceof MailCatcher ) {
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
- * Set the email headers in bulk.
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
- * @param array $reply_to
110
*/
111
- public function set_reply_to( $reply_to );
112
113
/**
114
- * Set the email return_path (when supported).
115
*
116
* @since 1.0.0
117
*
118
- * @param string $email
119
*/
120
- public function set_return_path( $email );
121
122
/**
123
- * Get the email body.
124
*
125
- * @since 1.0.0
126
*
127
- * @return string|array
128
*/
129
- public function get_body();
130
131
/**
132
- * Get the email headers.
133
*
134
- * @since 1.0.0
135
*
136
- * @return array
137
*/
138
- public function get_headers();
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 \PHPMailer class.
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
+ }
323
+
324
+ /**
325
+ * @inheritdoc
326
+ */
327
+ public function get_debug_info() {
328
+
329
+ $mg_text = array();
330
+
331
+ $options = new \WPMailSMTP\Options();
332
+ $mailgun = $options->get_group( 'mailgun' );
333
+
334
+ $mg_text[] = '<strong>Api Key / Domain:</strong> ' . ( ! empty( $mailgun['api_key'] ) && ! empty( $mailgun['domain'] ) ? 'Yes' : 'No' );
335
+
336
+ return implode( '<br>', $mg_text );
337
+ }
338
}
src/Providers/Mailgun/Options.php CHANGED
@@ -2,14 +2,14 @@
2
3
namespace WPMailSMTP\Providers\Mailgun;
4
5
- use WPMailSMTP\Providers\OptionAbstract;
6
7
/**
8
* Class Option.
9
*
10
* @since 1.0.0
11
*/
12
- class Options extends OptionAbstract {
13
14
/**
15
* Mailgun constructor.
2
3
namespace WPMailSMTP\Providers\Mailgun;
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/{OptionAbstract.php → OptionsAbstract.php} RENAMED
@@ -9,7 +9,7 @@ use WPMailSMTP\Options;
9
*
10
* @since 1.0.0
11
*/
12
- abstract class OptionAbstract implements OptionInterface {
13
14
/**
15
* @var string
9
*
10
* @since 1.0.0
11
*/
12
+ abstract class OptionsAbstract implements OptionsInterface {
13
14
/**
15
* @var string
src/Providers/{OptionInterface.php → OptionsInterface.php} RENAMED
@@ -8,7 +8,7 @@ namespace WPMailSMTP\Providers;
8
*
9
* @since 1.0.0
10
*/
11
- interface OptionInterface {
12
13
/**
14
* Get the mailer provider slug.
8
*
9
* @since 1.0.0
10
*/
11
+ interface OptionsInterface {
12
13
/**
14
* Get the mailer provider slug.
src/Providers/Pepipost/Mailer.php ADDED
@@ -0,0 +1,15 @@
1
+ <?php
2
+
3
+ namespace WPMailSMTP\Providers\Pepipost;
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\Pepipost
12
+ */
13
+ class Mailer extends MailerAbstract {
14
+
15
+ }
src/Providers/Pepipost/Options.php CHANGED
@@ -2,14 +2,14 @@
2
3
namespace WPMailSMTP\Providers\Pepipost;
4
5
- use WPMailSMTP\Providers\OptionAbstract;
6
7
/**
8
- * Class Option.
9
*
10
* @since 1.0.0
11
*/
12
- class Option extends OptionAbstract {
13
14
/**
15
* Pepipost constructor.
2
3
namespace WPMailSMTP\Providers\Pepipost;
4
5
+ use WPMailSMTP\Providers\OptionsAbstract;
6
7
/**
8
+ * Class Options.
9
*
10
* @since 1.0.0
11
*/
12
+ class Options extends OptionsAbstract {
13
14
/**
15
* Pepipost constructor.
src/Providers/SMTP/Mailer.php ADDED
@@ -0,0 +1,15 @@
1
+ <?php
2
+
3
+ namespace WPMailSMTP\Providers\SMTP;
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\SMTP
12
+ */
13
+ class Mailer extends MailerAbstract {
14
+
15
+ }
src/Providers/SMTP/Options.php CHANGED
@@ -2,14 +2,14 @@
2
3
namespace WPMailSMTP\Providers\SMTP;
4
5
- use WPMailSMTP\Providers\OptionAbstract;
6
7
/**
8
* Class SMTP.
9
*
10
* @since 1.0.0
11
*/
12
- class Options extends OptionAbstract {
13
14
/**
15
* SMTP constructor.
2
3
namespace WPMailSMTP\Providers\SMTP;
4
5
+ use WPMailSMTP\Providers\OptionsAbstract;
6
7
/**
8
* Class SMTP.
9
*
10
* @since 1.0.0
11
*/
12
+ class Options extends OptionsAbstract {
13
14
/**
15
* SMTP constructor.
src/Providers/Sendgrid/Mailer.php CHANGED
@@ -30,11 +30,11 @@ class Mailer extends MailerAbstract {
30
*
31
* @since 1.0.0
32
*
33
- * @param \PHPMailer $phpmailer
34
*/
35
public function __construct( $phpmailer ) {
36
37
- // We want to prefill everything from \PHPMailer class.
38
parent::__construct( $phpmailer );
39
40
$this->set_header( 'Authorization', 'Bearer ' . $this->options->get( $this->mailer, 'api_key' ) );
@@ -213,7 +213,8 @@ class Mailer extends MailerAbstract {
213
if ( is_file( $attachment[0] ) && is_readable( $attachment[0] ) ) {
214
$file = file_get_contents( $attachment[0] );
215
}
216
- } catch ( \Exception $e ) {
217
$file = false;
218
}
219
@@ -291,4 +292,53 @@ class Mailer extends MailerAbstract {
291
*/
292
public function set_return_path( $email ) {
293
}
294
}
30
*
31
* @since 1.0.0
32
*
33
+ * @param \WPMailSMTP\MailCatcher $phpmailer
34
*/
35
public function __construct( $phpmailer ) {
36
37
+ // We want to prefill everything from \WPMailSMTP\MailCatcher class, which extends \PHPMailer.
38
parent::__construct( $phpmailer );
39
40
$this->set_header( 'Authorization', 'Bearer ' . $this->options->get( $this->mailer, 'api_key' ) );
213
if ( is_file( $attachment[0] ) && is_readable( $attachment[0] ) ) {
214
$file = file_get_contents( $attachment[0] );
215
}
216
+ }
217
+ catch ( \Exception $e ) {
218
$file = false;
219
}
220
292
*/
293
public function set_return_path( $email ) {
294
}
295
+
296
+ /**
297
+ * Get a SendGrid-specific response with a helpful error.
298
+ *
299
+ * @since 1.2.0
300
+ *
301
+ * @return string
302
+ */
303
+ protected function get_response_error() {
304
+
305
+ $body = (array) wp_remote_retrieve_body( $this->response );
306
+
307
+ $error_text = array();
308
+
309
+ if ( ! empty( $body['errors'] ) ) {
310
+ foreach ( $body['errors'] as $error ) {
311
+ if ( property_exists( $error, 'message' ) ) {
312
+ // Prepare additional information from SendGrid API.
313
+ $extra = '';
314
+ if ( property_exists( $error, 'field' ) && ! empty( $error->field ) ) {
315
+ $extra .= $error->field . '; ';
316
+ }
317
+ if ( property_exists( $error, 'help' ) && ! empty( $error->help ) ) {
318
+ $extra .= $error->help;
319
+ }
320
+
321
+ // Assign both the main message and perhaps extra information, if exists.
322
+ $error_text[] = $error->message . ( ! empty( $extra ) ? ' - ' . $extra : '' );
323
+ }
324
+ }
325
+ }
326
+
327
+ return implode( '<br>', $error_text );
328
+ }
329
+
330
+ /**
331
+ * @inheritdoc
332
+ */
333
+ public function get_debug_info() {
334
+
335
+ $mg_text = array();
336
+
337
+ $options = new \WPMailSMTP\Options();
338
+ $mailgun = $options->get_group( 'sendgrid' );
339
+
340
+ $mg_text[] = '<strong>Api Key:</strong> ' . ( ! empty( $mailgun['api_key'] ) ? 'Yes' : 'No' );
341
+
342
+ return implode( '<br>', $mg_text );
343
+ }
344
}
src/Providers/Sendgrid/Options.php CHANGED
@@ -2,14 +2,14 @@
2
3
namespace WPMailSMTP\Providers\Sendgrid;
4
5
- use WPMailSMTP\Providers\OptionAbstract;
6
7
/**
8
* Class Option.
9
*
10
* @since 1.0.0
11
*/
12
- class Options extends OptionAbstract {
13
14
/**
15
* Options constructor.
2
3
namespace WPMailSMTP\Providers\Sendgrid;
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
* Options constructor.
wp-mail-smtp.php CHANGED
@@ -28,8 +28,27 @@ spl_autoload_register( function ( $class ) {
28
// Get the relative class name.
29
$relative_class = substr( $class, strlen( $plugin_space ) + 1 );
30
31
// Prepare a path to a file.
32
- $file = wp_normalize_path( $base_dir . $relative_class . '.php' );
33
34
// If the file exists, require it.
35
if ( is_readable( $file ) ) {
28
// Get the relative class name.
29
$relative_class = substr( $class, strlen( $plugin_space ) + 1 );
30
31
+ /**
32
+ * Normalize a filesystem path.
33
+ * Copy of the `wp_normalize_path()` from WordPress 3.9.
34
+ *
35
+ * @since 1.2.0
36
+ *
37
+ * @param string $path
38
+ *
39
+ * @return string
40
+ */
41
+ $normalize = function( $path ) {
42
+ $path = str_replace( '\\', '/', $path );
43
+ $path = preg_replace( '|(?<=.)/+|', '/', $path );
44
+ if ( ':' === substr( $path, 1, 1 ) ) {
45
+ $path = ucfirst( $path );
46
+ }
47
+ return $path;
48
+ };
49
+
50
// Prepare a path to a file.
51
+ $file = $normalize( $base_dir . $relative_class . '.php' );
52
53
// If the file exists, require it.
54
if ( is_readable( $file ) ) {
wp_mail_smtp.php CHANGED
@@ -1,856 +1,856 @@
1
- <?php
2
- /**
3
- * Plugin Name: WP Mail SMTP
4
- * Version: 1.1.0
5
- * Plugin URI: https://wpforms.com/
6
- * Description: Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings.
7
- * Author: WPForms
8
- * Author URI: https://wpforms.com/
9
- * Text Domain: wp-mail-smtp
10
- * Domain Path: /languages
11
- */
12
-
13
- /**
14
- * @author WPForms
15
- * @copyright WPForms, 2007-17, All Rights Reserved
16
- * This code is released under the GPL licence version 3 or later, available here
17
- * http://www.gnu.org/licenses/gpl.txt
18
- */
19
-
20
- define( 'WPMS_PLUGIN_VER', '1.1.0' );
21
- define( 'WPMS_PHP_VER', '5.3' );
22
-
23
- /**
24
- * Setting options in wp-config.php
25
- *
26
- * Specifically aimed at WPMU users, you can set the options for this plugin as
27
- * constants in wp-config.php. This disables the plugin's admin page and may
28
- * improve performance very slightly. Copy the code below into wp-config.php.
29
- */
30
-
31
- /*
32
- define('WPMS_ON', true);
33
- define('WPMS_MAIL_FROM', 'From Email');
34
- define('WPMS_MAIL_FROM_NAME', 'From Name');
35
- define('WPMS_MAILER', 'smtp'); // Possible values 'smtp', 'mail', or 'sendmail'
36
- define('WPMS_SET_RETURN_PATH', 'false'); // Sets $phpmailer->Sender if true
37
- define('WPMS_SMTP_HOST', 'localhost'); // The SMTP mail host
38
- define('WPMS_SMTP_PORT', 25); // The SMTP server port number
39
- define('WPMS_SSL', ''); // Possible values '', 'ssl', 'tls' - note TLS is not STARTTLS
40
- define('WPMS_SMTP_AUTH', true); // True turns on SMTP authentication, false turns it off
41
- define('WPMS_SMTP_USER', 'username'); // SMTP authentication username, only used if WPMS_SMTP_AUTH is true
42
- define('WPMS_SMTP_PASS', 'password'); // SMTP authentication password, only used if WPMS_SMTP_AUTH is true
43
- */
44
-
45
- /**
46
- * Newer PHP version 5.3+ will be handled a lot differently,
47
- * with better code and newer logic.
48
- *
49
- * @since 1.0.0
50
- */
51
- if ( version_compare( phpversion(), WPMS_PHP_VER, '>=' ) ) {
52
- require_once dirname( __FILE__ ) . '/wp-mail-smtp.php';
53
- return;