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 the plugin from wordpress.org.


Could not connect to host

If you see an error like “Failed to connect to server”, the plugin is working, PHP cannot connect to the server. Look at the whole error message and investigate from there. Check your php.ini settings around fopen() permissions, check your SMTP host is correct, or contact your server administrator.

If your error is “Cannot connect to host”, please look for support elsewhere, please do not ask for support here. These questions have been asked many times before, please search the history. The plugin is working, the issue lies elsewhere.

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

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!)


If you would like to translate this plugin, you can download the POT file here.

Other Problems

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

Support: Post questions here

Multi Site

This plugin was compatible with WordPressMU back in the day. I recommend if using the plugin on a multi-site setup, put your settings in wp-config.php and then disable the admin menu. This means you can set options once that will apply to all sites in your network. Allowing each site to set their own options is also possible, but might lead to unexpected results, and potentially, many more support requests.


The password is displayed in plain text on the admin page because it must be stored in plain text in the database. WordPress needs the password when it connects to your mail server, and needs it in plain text. There is no simple workaround to this. Changing the input field to type=password would only make it look like it was “secure” when in fact the password would still be in plain text in the page source code.


See the changelog on wordpress.org.

106 thoughts on “WP Mail SMTP”

  1. @ADR: Can you post the error message line from the debug output? The error message will hopefully tell you where the problem lies.

  2. WOW.. Thank you. Yoru plugin worked !!

    I am not a PHP guru but as an engineer have good enough intutive skils to dig around code.

    How can I cutomize the emails that are being send with the user name & password.

    I just want to add some more welcome text to be polite rather tahn just the username & password. Where in the code can I do it ?

    Any help please

  3. @Henry: The plugin hooks into the function wp_mail(). So look for all instances of “wp_mail” in the code and you’ll find all the places where emails are sent. There may be a hook or filter you can use to change the text of the emails. If you’d like my professional help, contact me to discuss.

  4. I simply cannot get it to work. I have tried numerous settings and all test emails fail. bool(false)

    I even tried with the gmail smtp server and no dice:

    object(SMTP)#132 (6) {
    string(2) ”

    array(3) {
    string(27) “Failed to connect to server”
    string(18) “Connection refused”

  5. I was having a problem with the Workpress site for my ADDON domain (only). Emails are not being received by those who register at my WordPress blog. There are no errors in the registration process, and the new user appears in the WordPress user admin panel. The email password is just not being sent. (I’ve tested with my own email accounts, and it’s not a spam issue).
    I created a wordpress@myaddondomain.com, and wordpress@myaddondomain.myprimarydomain.com , which was suggested on another site. Nothing worked.

    I added your plugin and LIFE IS SWEET. Thanks!

  6. Everything works fine except when the e-mail is sent it does not include a password or a verification link. So if I try to register with the test username and password I created earlier, it says invalid username or password.

    I too, love this plug in. I have wrestled for weeks with the php mail and accomplished nothing. I was so happy when my text came through – but alas no registration link or password.

    Can you help?

    Thanks so much

  7. @Carol: I’m not sure why the emails don’t include the links. Are they being sent without the links, or just not sent at all? It sounds like a WordPress problem, are you running the very latest version? Right now that’s 2.3.2.

  8. I get the following error when sending emails from my home hosted wordpress:

    (host a.mx.mail.yahoo.com[] refused to talk to me: 553 Mail from xx.xx.xx.xx not allowed – 5.7.1 [23] Connections not accepted from IP addresses on Spamhaus XBL; see http://postmaster.yahoo.com/550571-2.html [550])

    It looks like a spam issue and happens with gmail and yahoo recepients. Any ideas what’s going on?

  9. @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.

  10. Awesome plugen mate!

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

    Works great!


  11. 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)”

  12. @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?

  13. 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,

  14. 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!

  15. 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! 🙂

  16. 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!

  17. 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?


  18. 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.

  19. 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) {
    string(5) “UTF-8”
    string(10) “text/plain”
    string(4) “8bit”
    string(69) “Language string failed to load: recipients_failedphoneyname@phoneydomain.com

    Any hints on how to work around this?

    Many Thanks!


  20. 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.

  21. 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. 🙂

  22. 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.

  23. 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.

  24. 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 🙂

  25. 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:


    The full debugging output is shown below:

    object(phpmailer)(39) {
      string(5) "UTF-8"
      string(10) "text/plain"
      string(4) "8bit"
      string(64) "Language string failed to load: from_failedadmin[at]blog.sfmoma.org"
      string(21) "admin[at]blog.sfmoma.org"
      string(17) "SFMOMA blog admin"
      string(0) ""
      string(45) "WP Mail SMTP: Test mail to hellvert[at]yahoo.com"
      string(68) "This is a test email generated by the WP Mail SMTP WordPress plugin."
      string(0) ""
      string(4) "smtp"
      string(18) "/usr/sbin/sendmail"
      string(0) ""
      string(4) "1.73"
      string(0) ""
      string(0) ""
      string(20) "mail.blog.sfmoma.org"
      string(0) ""
      string(21) "admin[at]blog.sfmoma.org"
      string(8) "######"
      &object(smtp)(6) {
        string(2) "
        array(1) {
          string(38) "Called Reset() without being connected"
      array(1) {
        array(2) {
          string(18) "hellvert[at]yahoo.com"
          string(0) ""
      array(0) {
      array(0) {
      array(0) {
      array(0) {
      array(0) {
      string(5) "plain"
      array(2) {
        string(35) "b1_d9a1bc908e49f6a0bc947cc1d18305d8"
        string(35) "b2_d9a1bc908e49f6a0bc947cc1d18305d8"
      array(0) {
      string(1) "

    The SMTP debugging output is shown below:

    421 cl21.gs01.gridserver.com: Too much load; please try again later
    SMTP -> ERROR: EHLO not accepted from server: 
    SMTP -> ERROR: HELO not accepted from server: 
    SMTP -> ERROR: AUTH not accepted from server: 
    EOF caught while checking if connected
  26. By the way, I noticed that I left the password in the debugging info! I just changed the password… 😉

  27. 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!

  28. @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!)

Comments are closed.