WP Mail SMTP

This WordPress plugin reconfigures the wp_mail() function so all mail from your blog can be sent by SMTP instead of using PHP’s mail() function. The plugin also adds an Options > Email page which allows you to configure the settings from the admin interface of your site.

Download: Current Version: 0.8.2, Released 14/Dec/2008

Support: Post questions here

Changelog

0.8.2 - Bugfix, call phpmailer_init_smtp() correctly, props Sinklar.
0.8.1 Internationalisation improvements.
0.8 - Added port, SSL/TLS, option whitelisting, validate_email(), and constant options.
0.7 - Added checks to only override the default from name / email
0.6 - Added additional SMTP debugging output
0.5.2 - Fixed a pre 2.3 bug to do with mail from
0.5.1 - Added a check to display a warning on versions prior to 2.3
0.5.0 - Upgraded to match 2.3 filters which add a second filter for from name
0.4.2 - Fixed a bug in 0.4.1 and added more debugging output
0.4.1 - Added $phpmailer->ErroInfo to the test mail output
0.4 - Added the ability to send a test email
0.3.2 - Changed to use register_activation_hook for greater compatability
0.3.1 - Added readme for WP-Plugins.org compatability
0.3 - Various bugfixes and added From options
0.2 - Reworked approach as suggested by westi, added options page
0.1 - Initial approach, copying the wp_mail function and replacing it

WordPressMU

Since version 0.8, this plugin is WPMU compatible. I recommend setting your options as constants in wp-config.php (see line 19 in the plugin file). This will disable the options page, slightly improve performance, and apply the same settings across your entire WPMU site.

Troubleshooting

No email from plugins?

If you’re using plugins to send email, these plugins will ignore the SMTP settings if they call PHP’s mail() function directly. If you see the function mail() and not wp_mail() in the plugin’s source, that’s the problem. You should be able to simply add wp_ in front of the existing mail command and it will probably work! (Insert lawyer-speak no warranty blurb here!)

Gmail / Google Apps

To send email via Gmail or Google Apps, use these settings:

Mailer: SMTP
SMTP Host: smtp.gmail.com
SMTP Port: 465
Encryption: SSL
Authentication: Yes
Username: your full gmail address
Password: your mail password

Other Problems

Try sending a test email. The error message should help you detect your problem.

76 Comments

  1. Posted 13 Jan 2008 at 06:16 | Permalink

    @Igor: The error means that you can’t send mail from your domestic internet IP address because it’s suspected as spam. Instead, try setting your SMTP host to be your ISP’s mail server. That will normally work.

  2. Angelo
    Posted 29 Jan 2008 at 18:06 | Permalink

    i set everything but i get bool(false)

    and this error message

    string(75) “Language string failed to load: recipients_failedmytestemail@address.com

    what happen?

    thanks a lot!

  3. Static
    Posted 07 Feb 2008 at 15:26 | Permalink

    Awesome plugen mate!

    Just what I was looking for to circumvent may hosts ban on phpmail().

    Works great!

    //Static

  4. Posted 16 Feb 2008 at 20:20 | Permalink

    I can’t seem to save the options using WordPress MU. Any ideas?

  5. Posted 17 Feb 2008 at 06:43 | Permalink

    WordPress MU recently changed the way options are handled. If you’re running a version of MU later than r1188 that will be your problem. If not, you’d need to give me more information to be able to help.

  6. Posted 24 Feb 2008 at 02:54 | Permalink

    THANK YOU for this plugin, it fixed my new register and lost password emailer problem quick.

    I did a test register and got the e-mail but there’s a misspelling in the e-mail’s header, is this in your plugin or somewhere else? Where would I edit this at? It misspelled “infomation”

    “Your register infomation from (my site blah blah)”

  7. Posted 24 Feb 2008 at 15:31 | Permalink

    @Nate: The plugin doesn’t add any text to the email itself, so any spelling errors would be as a result of either a misspelling in some settings, or a bug in a plugin or WordPress. Can you forward me a copy of the whole email to see what you mean?

  8. early
    Posted 10 Mar 2008 at 13:30 | Permalink

    Hello,

    I tried the plugin today, first I got the same error message like Angelo mentinoed before:

    string(75) “Language string failed to load: recipients_failed”

    Now, after reconfiguration I get the error

    ["ErrorInfo"]=> string(43) “Language string failed to load: instantiate”

    Does anyone have an idea for a solution?

    Thank you,
    Jens

  9. Fred
    Posted 25 Mar 2008 at 18:37 | Permalink

    Yep, I get the same message! Language string failed to load: instantiate

    I would put here the entire log if that helped..Thanks for the plugin and help!

  10. Posted 26 Mar 2008 at 06:39 | Permalink

    Argh. There does seem to be a recurring problem with this language string thing. I’ll get into it soon. I can’t ignore it any longer! :)

  11. Yannick
    Posted 28 Mar 2008 at 13:17 | Permalink

    Hi,

    I’ve installed WP Mail SMTP, but for some reason it does not work when an email is sent to a hotmail address…

    I use STMP without authentification and send out a test email. When I send it to my yahoo account it works fine, but when I send it to my hotmail it doesn’t…ANy ideas on how I could fix this?

    Thank you!

  12. Posted 30 Mar 2008 at 17:25 | Permalink

    Hello,

    I just installed this plug-in today and it seems to be a little flakey when sending out new registration emails. I am running WordPress 2.5 and have no other email plug-ins installed.

    My problem is similar to that of Yannick. When I register a user using a gmail account then the administrator receives his email AND the newly registered user receives their email including their password. However, whenever a new user registers using a hotmail or yahoo address, the admin still receives his email fine, BUT the user never receives the email stating their password.

    I am not using the SMTP authentication either, as i´m not entirely sure what it is asking for in those two fields.

    Is there something else I need to do to enable other accounts to receive their passwords?

    Thanks,

  13. Posted 31 Mar 2008 at 14:00 | Permalink

    Callum,
    Do you know if there are any bugs with this plugin using it wp 2.5?

    I would like to upgrade but am extremely hesitant.

  14. Posted 01 Apr 2008 at 12:17 | Permalink

    I just installed this, and got the dreaded message upon sending a test message to an email address not in my own domain:

    The full debugging output is shown below:

    object(PHPMailer)#108 (39) {
    ["Priority"]=>
    int(3)
    ["CharSet"]=>
    string(5) “UTF-8″
    ["ContentType"]=>
    string(10) “text/plain”
    ["Encoding"]=>
    string(4) “8bit”
    ["ErrorInfo"]=>
    string(69) “Language string failed to load: recipients_failedphoneyname@phoneydomain.com

    Any hints on how to work around this?

    Many Thanks!

    -Deb

  15. Posted 24 Apr 2008 at 22:58 | Permalink

    Some encoding problems with chineses char. Is it a client side problem?

  16. NEM
    Posted 28 Apr 2008 at 14:58 | Permalink

    What a great and helpful posting … I was just putting up WordPress for a client on an IIS box with PHP 5 and MySQL 5, and couldn’t quite get the SMTP thing working properly via PHP. Your plugin was a snap. thanks a lot.

  17. Posted 30 Apr 2008 at 23:19 | Permalink

    I have released a new version of the plugin with additional debugging output. If you were previously having problems, please try this new version and then send me the SMTP debugging output. Please note, I’ll now only respond to questions about version 0.6, so if you’re still waiting for an answer to an old question, please upgrade, test again, and let me know if you’re still having issues. :)

  18. Posted 01 May 2008 at 00:53 | Permalink

    Further update, I’ve released version 0.7 which will only change the from name and email if they are the defaults. Previously the plugin would modify these even if they had been specifically set by WordPress or another plugin. I recommend everyone upgrade to 0.7.

  19. Posted 01 May 2008 at 01:22 | Permalink

    My problem was that for chinese characteres we can see only question tags like this:

    ???? ?????????? ???? ???? ?????

    I think it is a problem with bad webmail like hotmail who cannot manage correctly UTF-8 encoding, I solved it by using the php funtion htmlentities() and evrerything is OK now.

    Thanks for your reply.

  20. Posted 01 May 2008 at 02:30 | Permalink

    I use this wp-mail and I must say. This is fantastic things, I work for it and this is work very well

  21. Posted 01 May 2008 at 07:31 | Permalink

    Unfortunately, I am still having the same issue. I don’t get any errors or anything and the test email says success to all three types of email addresses that I have tried. The confirmation emails just never arrive if I use any address other than one that ends with @gmail.com.

    I’ve tried Yahoo and Hotmail emails and neither of them get their confirmation emails, however, the admin email receives the email immediately about a new user registering.

    The GMail accounts are also the only ones that receive the test email if I send them out.

    Am I just overlooking something here?

    Thanks :)

  22. Posted 01 May 2008 at 08:40 | Permalink

    @Jerod: Try sending a test email to a Yahoo and Hotmail address, and then email me the output of the SMTP debug. It might be something to do with your mail server.

  23. Gilbert
    Posted 02 May 2008 at 11:17 | Permalink

    Hi,

    I’m having problems with your plugin. The concept is great, but it doesn’t seem to work. I updated to 0.7 and tested it with a yahoo address and it sent the test email. Then I tried another email address and I got an error. So I tried the yahoo address again, and this time an error came up!

    Here’s the output of the error:

    Test Message Sent

    The result was:

    bool(false)

    The full debugging output is shown below:

    object(phpmailer)(39) {
      ["Priority"]=>
      int(3)
      ["CharSet"]=>
      string(5) "UTF-8"
      ["ContentType"]=>
      string(10) "text/plain"
      ["Encoding"]=>
      string(4) "8bit"
      ["ErrorInfo"]=>
      string(64) "Language string failed to load: from_failedadmin[at]blog.sfmoma.org"
      ["From"]=>
      string(21) "admin[at]blog.sfmoma.org"
      ["FromName"]=>
      string(17) "SFMOMA blog admin"
      ["Sender"]=>
      string(0) ""
      ["Subject"]=>
      string(45) "WP Mail SMTP: Test mail to hellvert[at]yahoo.com"
      ["Body"]=>
      string(68) "This is a test email generated by the WP Mail SMTP WordPress plugin."
      ["AltBody"]=>
      string(0) ""
      ["WordWrap"]=>
      int(0)
      ["Mailer"]=>
      string(4) "smtp"
      ["Sendmail"]=>
      string(18) "/usr/sbin/sendmail"
      ["PluginDir"]=>
      string(0) ""
      ["Version"]=>
      string(4) "1.73"
      ["ConfirmReadingTo"]=>
      string(0) ""
      ["Hostname"]=>
      string(0) ""
      ["Host"]=>
      string(20) "mail.blog.sfmoma.org"
      ["Port"]=>
      int(25)
      ["Helo"]=>
      string(0) ""
      ["SMTPAuth"]=>
      bool(true)
      ["Username"]=>
      string(21) "admin[at]blog.sfmoma.org"
      ["Password"]=>
      string(8) "######"
      ["Timeout"]=>
      int(10)
      ["SMTPDebug"]=>
      int(2)
      ["SMTPKeepAlive"]=>
      bool(false)
      ["smtp"]=>
      &object(smtp)(6) {
        ["SMTP_PORT"]=>
        int(25)
        ["CRLF"]=>
        string(2) "
    "
        ["do_debug"]=>
        int(2)
        ["smtp_conn"]=>
        int(0)
        ["error"]=>
        array(1) {
          ["error"]=>
          string(38) "Called Reset() without being connected"
        }
        ["helo_rply"]=>
        NULL
      }
      ["to"]=>
      array(1) {
        [0]=>
        array(2) {
          [0]=>
          string(18) "hellvert[at]yahoo.com"
          [1]=>
          string(0) ""
        }
      }
      ["cc"]=>
      array(0) {
      }
      ["bcc"]=>
      array(0) {
      }
      ["ReplyTo"]=>
      array(0) {
      }
      ["attachment"]=>
      array(0) {
      }
      ["CustomHeader"]=>
      array(0) {
      }
      ["message_type"]=>
      string(5) "plain"
      ["boundary"]=>
      array(2) {
        [1]=>
        string(35) "b1_d9a1bc908e49f6a0bc947cc1d18305d8"
        [2]=>
        string(35) "b2_d9a1bc908e49f6a0bc947cc1d18305d8"
      }
      ["language"]=>
      array(0) {
      }
      ["error_count"]=>
      int(4)
      ["LE"]=>
      string(1) "
    "
    }

    The SMTP debugging output is shown below:

    SMTP -> FROM SERVER:
    421 cl21.gs01.gridserver.com: Too much load; please try again later
    SMTP -> FROM SERVER:
    SMTP -> ERROR: EHLO not accepted from server:
    SMTP -> FROM SERVER:
    SMTP -> ERROR: HELO not accepted from server:
    SMTP -> ERROR: AUTH not accepted from server:
    SMTP -> NOTICE:
    EOF caught while checking if connected
  24. Gilbert
    Posted 02 May 2008 at 11:39 | Permalink

    By the way, I noticed that I left the password in the debugging info! I just changed the password… ;)

  25. Gilbert
    Posted 02 May 2008 at 12:05 | Permalink

    So I clicked the radio button to switch from smtp to php mail() :

    * Use the PHP mail() function to send emails.

    Now I don’t seem to be getting any error messages! I sent a couple of test emails and they all worked!

    However, I tried registering on my blog with a yahoo email address and I never received the confirmation email with the user password. I tried registering with other email including gmail accounts and the confirmation emails came through.

    What’s up with yahoo?

    Thanks for working on these problems. I appreciate it very much!

  26. Posted 03 May 2008 at 00:07 | Permalink

    @Gilbert: The problem is this line in your SMTP log:

    421 cl21.gs01.gridserver.com: Too much load; please try again later

    It seems your mail server is too busy to deal with you! What about if you try setting the mail to send by SMTP but to localhost with no authentication? Does that work? Are you on a shared hosting server? Most shared hosting normally have web and mail on the same box, so SMTP to localhost usually works fine.

    (I removed your password and obfuscated your email, hopefully you’ll get a little less spam!)

30 Trackbacks

  1. [...] WP Mail SMTP replaces the in-built wp_mail() function with a duplicate function which uses SMTP to localhost instead of PHP mail. [...]

  2. [...] WP Mail SMTP replaces the in-built wp_mail() function with a duplicate function which uses SMTP to localhost instead of PHP mail. [...]

  3. [...] באו לקיצן בזכות התוסף WP Mail SMTP. התוסף מאפשר לבחור בשיטת שליחת הדוא”ל של מערכת [...]

  4. [...] Visit [...]

  5. [...] WP Mail SMTP replaces the in-built wp_mail() function with a duplicate function which uses SMTP to localhost instead of PHP mail. [...]

  6. By Jody Sachse - Wandering the Webernet on 10 Oct 2007 at 03:02

    [...] WP Mail SMTP replaces the in-built wp_mail() function with a duplicate function which uses SMTP to localhost instead of PHP mail. [...]

  7. By わーどぷれすっ! » WP Mail SMTP on 19 Oct 2007 at 14:50

    [...] WP Mail SMTP at Callum Macdonald [...]

  8. [...] but I’ve now got that straightened out with a (still slightly-buggy) plugin called WP Mail SMTP. I had to add my admin e-mail to the options for BlueHost’s PHP mail function to work [...]

  9. [...]   刚才开始用WP-Mail-SMTP,不知道是我的设置问题还是服务器问题,总是收到到邮件,到用的是126的SMTP,好像126不支持SMTP吧,不太清楚.后面看到一个插件,专门为GMAIL设计的,ShiftThis.net | Swift SMTP,就是它,在WordPress  下载了它的最新版本,然后设置为GMAIL ,然后Test Connection ,看了看邮箱,成功.不过ShiftThis.net | Swift SMTP文件比较大,有一M多,像国内下载的话很慢,有的时候根本就连接不上,还好,搞到了无界8.7 ,我就用无界作代理,下载下来了. [...]

  10. [...] Download it here. Configure it to use SMTP instead of the php_mail() function. [...]

  11. [...] soluciones para arreglar el problema del correo en Wordpress y terminé optando por el plugin WP Mail SMTP. Este plugin lo que hace es reconfigurar de manera correcta la forma en que Wordpress envía los [...]

  12. [...] que traía aparejado problemas en los envíos del correo desde este CMS. Solución, el plugin WP Mail SMTP, creado por Callum Macdonald, que nos cuenta que sirve justo para reconfigurar la función [...]

  13. [...] Neue Plugins im Einsatz:  Post Notification, Similar Posts, WP-Mail-SMTP [...]

  14. [...] after some time, I have found this wonderful plugin called “WP Mail SMTP”. With it, we can configure NOT to use sendmail, but instead use SMTP for sending mails. [...]

  15. By WP Plugin Archive » WP Mail SMTP on 19 Mar 2008 at 05:26

    [...] WordPress Plugin WP Mail SMTP von Callum Macdonald rekonfiguriert die  wp_mail() Function so das die Email des Blogs per SMTP [...]

  16. [...] released a new version of the WP Mail SMTP plugin. There were a stream of similar questions about one particular error message over the last few [...]

  17. By WP Mail SMTP v0.7 at Callum Macdonald on 03 May 2008 at 02:18

    [...] be sure to look back at previous questions before posting here. « Charles with Etihad [...]

  18. [...] 5.WP-Mail-SMTP:使wp支持smtp邮件的插件。 [...]

  19. [...] ist nicht unbedingt zwingend nötig. Alternativ könnte man die WordPress-Erweiterung WP Mail SMTP nutzen. Damit weist man WordPress an, für das Versenden der Mails keinen lokalen Mailserver [...]

  20. [...] downloading of plugin (WP-Mail-SMTP by the way), install it…. and then totally forget my mail server [...]

  21. [...] som trodde att det gick att registrera sig! Men icke, jag kunde bara skicka internt. Men hittade WP Mail SMTP tackar som f** för det. Så NU ska det fungera. Ni som har försökt att skapa en användare på [...]

  22. [...] WP-Mail-SMTP 如果你的免费空间或者虚拟主机没有SMTP服务,你可以安装这个插件来使用外部SMTP, [...]

  23. [...] מומלצת: כדאי לשלב ב-PN גם את התוסף WP Mail SMTP כי שימוש ב-PN בלבד מוסיף ל-Header של הדוא”ל שנשלח למנוי גם [...]

  24. [...] used WP-Mail-SMTP. It was simple to install, i.e. point and click and simple to configure. There is even a test [...]

  25. By » Blog Archive on 27 Sep 2008 at 02:33

    [...] por la web de la información, navegando buscando una solución. Así fue como descubrí un plugin Wp-Mail-Smtp que te envia los correos de wordpress a través de una cuenta externa. Después de navegar un rato [...]

  26. By Paula’s Page »  WP SMTP Mail on 25 Nov 2008 at 00:26
  27. By Moving Wordpress from Apache to IIS on 25 Nov 2008 at 18:05

    [...] WP-Mail-SMTP - This is very important, as it allows WordPress to send email For kiwihost you just need to set SMTP Host to “localhost” and Authentication to “No: Do not use SMTP authentication.” [...]

  28. [...] also installed the Subscribe To Comments and WP-Mail-SMTP plugins earlier this evening which allow readers to subscribe to new comments as well as manage [...]

  29. [...] WP-Mail-SMTP — позволяет отправлять письма через внешний SMTP-сервер По традиции в версии Normal всего два плагина — russian date и rus-to-lat [...]

  • Categories

  • History