WP Mail SMTP v0.8

As promised, I’m releasing version 0.8 of the WP Mail SMTP plugin just a few days after WordPress 2.7 was released.

There are some big changes in this version. Firstly, I added option whitelisting to be forward compatible with WordPress. This also makes the plugin compatible with WordPressMU. However, this means version 0.8 is is only compatible with 2.7 or newer. This version will not work on WordPress 2.6.5 or earlier.

I’m going to hold off pushing this update to wordpress.org for a couple of days. I’m hoping to get some feedback from early testers. If there are no disasters, I’ll release 0.8 onto wordpress.org early next week.

Support Questions

If you have a question, please search the questions for 0.7 and the original questions before asking it here.

Please note: If you post email addresses in the body of the comments you will almost certainly receive spam. Please replace all @ symbols with something else when you post the debugging output (not in the email box, just in the comment box).

1,201 thoughts on “WP Mail SMTP v0.8

  1. Hi Callum,
    Because PHP ereg function has been DEPRECATED as of PHP 5.3.0, your plugin needs a patch on email validation, replacing ereg with preg_match.

    Below I leave you the fix but if you want, write me an email and I will send you the diff file.

    diff -r 18d67b4f4f9e wp-content/plugins/wp-mail-smtp/wp_mail_smtp.php
    — a/wp-content/plugins/wp-mail-smtp/wp_mail_smtp.php Fri Nov 01 15:42:05 2013 +0000
    +++ b/wp-content/plugins/wp-mail-smtp/wp_mail_smtp.php Fri Nov 01 16:00:20 2013 +0000
    @@ -348,7 +348,7 @@
    */
    if (!function_exists(‘validate_email’)) :
    function validate_email( $email, $check_domain = true) {
    - if (ereg(‘^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+’.'@’.
    + if (preg_match(‘^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+’.'@’.
    ‘[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.’.
    ‘[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$’, $email))
    {

      • Callum,
        I’m really sorry about my mistake: I forgot to escape some slashes…

        Below you will find the right diff

        diff -r 18d67b4f4f9e wp-content/plugins/wp-mail-smtp/wp_mail_smtp.php
        — a/wp-content/plugins/wp-mail-smtp/wp_mail_smtp.php Fri Nov 01 15:42:05 2013 +0000
        +++ b/wp-content/plugins/wp-mail-smtp/wp_mail_smtp.php Fri Nov 01 16:32:56 2013 +0000
        @@ -348,9 +348,9 @@
        */
        if (!function_exists(‘validate_email’)) :
        function validate_email( $email, $check_domain = true) {
        - if (ereg(‘^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+’.'@’.
        + if (preg_match(‘/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`a-z{|}~]+’.'@’.
        ‘[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.’.
        - ‘[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$’, $email))
        + ‘[-!#$%&\'*+\\.\/0-9=?A-Z^_`a-z{|}~]+$/’, $email))
        {
        if ($check_domain && function_exists(‘checkdnsrr’)) {
        list (, $domain) = explode(‘@’, $email);

  2. Hi Callum! I updated your plugin about 10 minutes ago and right after I did I was unable to access anywhere in my WP Dashboard. I had to go in through FTP and delete the plugin.

    • When I tried to upload and activate it again, this is what I got:

      Fatal error: Call-time pass-by-reference has been removed; If you would like to pass argument by reference, modify the declaration of apply_filters(). in /opt/bitnami/apache2/htdocs/wordpress_youthg/wp-content/plugins/wp-mail-smtp/wp_mail_smtp.php on line 109

        • Hi, your plug-in doesn’t update correctly with WordPress 3.7.1. I’m getting “Could not remove the old plug-in” error message when I try to update. Please advise… Thanks!

    • Thanks for the link, apologies for the issue. I’ve pushed a new version 0.9.3 now which should fix the problem. Please let me know if you have any further issues.

  3. The latest version of this plugin causes errors with the latest version of WordPress. Lines 109 and 150 contain bad syntax for function calls that will prevent wordpress from loading a web site once the plugin is updated to version 0.9.2

    • Apologies for the issue. I just pushed version 0.9.3 which should fix this problem. Please let me know if you have any further issues.

  4. Hi,

    I’m using your plugin in order to send emails via authenticated SMTP. I have now got it opened at the SMTP server so that we can relay there and the Test mail works – reports true and the mail arrives. However, if I try sending using wp_mail from my plugin it doesn’t work – wp_mail returns true and the email does not arrive. I put some debugging code in the wp_mail function, ihncluding that I debug out the $e->getMessage() from the catch block in the try/catch at the very end of wp_mail (when it tries to send the actual mail). This says “SMTP Error: Could not authenticate.” However, as said, the test mails work!

    I then started debuggin out the phpmailer object and comparing between my wp_mail call and yours. i noticed that the exceptions protected member was true for mine and not for the test mail. It appears that the global phpmailer does not exist when coming in to wp_mail in my call, so it is created in wp_mail using $phpmailer = new PHPMailer( true ) If I change that true to a false (i.e. set exceptions to false in the phpmailer object) then not only does wp_mail return true but the mail arrives!

    How can I be getting authentication errors but the mail still be arriving if I check for errors? Any ideas?

    • Replying to my own comment after further investigation.

      It appears that the Test Email function continues to try and send the email even if authentication fails. The mail server seems to allow me to relay even without authenticating so the Test Email gets through. Actual calls to wp_mail from my plugin fail if the authentication fails. If I turn of SMTP authentication then my mails work as well.

      I count this as a bug in the Test Email functionality – if the Test Email says OK then I should be able to rely on that that other wp_mail calls will work too. however, in this case I cannot. At the very least there should be a clear warning at the top of the test Email output (“Succeeded but with errors” or similar).

      • I’m assuming that you are sending to your own address with the test function. If you do that, most likely your mail server accepts it. It’s not so much a bug as a misunderstanding of the SMTP protocol. It could definitely be clearer on the admin page though. I’ll add something to make that more obvious.

        • The email I sent using the Test Email functionality in the plugin (which arrived) and the email I tried but failed to send using the wp_mail call in my plugin were both to the same address. The question is not whether the authentication worked or not, the point is that the Test Email functionality has a bug in that it reports that emails can be sent when wp_mail fails to be able to send the same mail. The whole point of the Test Email function is to test whether sending emails will work – if the result cannot be trusted then the function has a bug (in my opinion). As I said, at the very least there should be a clear warning that success from the Test Email function does not indicate that wp_mail will necessarily work.

          • The test email function calls wp_mail() and that’s it. There’s no magic to it. For a long time, the wp_mail() function returned true whether the mail was sent or not. I think that bug has now been fixed in WP core.

            If you’re using code>wp_mail() in your plugin, the result should be exactly the same as the test email function.

            • The Test Email function may use wp_mail, but it (or something else) must have created a global PHPMailer object before calling wp_mail. The Test Email function uses a debugging version of PHPMAiler (i.e. with exceptions allowed). wp_mail uses the existing PHPOMailer if it exists and otherwise creates one with exceptions not allowed.

              As I said in the original post, if we allow exceptions (i.e. if I change the “$phpmailer = new PHPMailer( true )” to “$phpmailer = new PHPMailer( false )” in wp_mail then my wp_mail calls work as well. But with wp_mail as it stands they don’t. If I set debugging code in wp_mail I see that the PHPMailer object used when Test Email calls wp_mail was created as “$phpmailer = new PHPMailer( false )”. wp_mail creates with true so the object must have been created before the wp_mail call. The problem is that this changes the functionality, including whether or not the mail actually arrives!

              • You’re absolutely right. The code in wp-includes/pluggable.php has changed, and now the PHPMailer() object is instantiated differently than it used to be. I’ll update the plugin and push a new version now. Those two were (and should be) identical. I need to instantiate the PHPMailer object in order to set the SMTP debugging in order to get the output. Enabling debugging shouldn’t change how the mail is sent, but instantiating the object differently may well make a difference.

                Thanks for the bug report. Apologies if I was overly dismissive, I get an awful lot of “my server no work, help” type emails about the plugin, and many from folks who seem to forget that the code was free! :-)

                • Thanks! I am aware that the code is free (and very much appreciated!). My initial report maybe should have been clearer.

                  As a side note, this forum doesn’t seem to cope with threads this long very well… :)

                  • Yeah, nested comments get a bit out of control.

                    So, I’ve looked into this a bit further, and it gets even weirder. In my tests, if I instantiate the PHPMailer() object with false then my test email sends, but if I set true it fails, with an actual SMTP server error. It seems like a combination of $exceptions = true; with $SMTPDebug = 2; causes mail sending to fail.

                    Ok, after a bit more research, it looks like the SMTPDebug option has changed from a numerical value to a boolean. Changing it to true works for me. Now I can send test emails and get a debug log, with the PHPMailer object instantiated with $exceptions = true;. :-)

  5. Hi, I’am using Contact Form 7.
    My settings:
    1) To send I installed the plugin WP-Mail-SMTP and configured:
    - From Email: email@nomesito.it
    - From Name: nomesito.it
    - Mailer: Send all WordPress emails via SMTP .
    - SMTP Host: [my internal SMTP service]
    - SMTP Port: 25
    - Encryption: No encryption .
    - Authentication: No: Do not use SMTP authentication .
    I made ​​a test using the form for this test and mail arrives correctly .
    2) I have configured my FORM of Contact Form 7 and everything is working correctly, because, as I have entered is specified in the “To:” and in the “From:” the same email as above, ie email@nomesito.it
    Performed a test, sending succeeds.
    I tried, however, to allow multiple selection of the recipient:
    [select * recipient
    "Technical Support | assistenzatecnica@nomesito.it"
    "Commercial | sales@nomesito.it"
    "General | rsalemi@nomesito.it"
    "Administrative support | amministrazione@nomesito.it"
    ]
    and set the two fields fields:
    - “TO:” -> [your recipient]
    - “FROM”: – > [your-name]
    Sending does not work anymore: this is because the field “To:” FORM is different from the “From Email:” in the configuration.
    I would like to avoid creating 4 contact blocks, you have any suggestions?
    The site will be published through my local server made ​​with Wampserver.
    Maybe instead of sending STMP should I use the PHPMailer class?
    Thanks in advance for your help.

    • I guess your issue relates to sending email to your own address via your own server. That usually works without authentication, but you can’t send mail to anywhere through your own server without authentication (otherwise your server would be used by spammers).

  6. Hi

    Need to set smtp plugin to send emails from original sender, not smtp authenticated user. Any idea how to go aobut it?

    wp 3.7.1 – SMTP 0.9.3

    tnx,

    Zvi

  7. I hope I’m not posting a duplicate question. I did search first.

    Anyway, my “test mail” to myself after configuration returns with this error message:

    ["ErrorInfo"]=>
    string(90) “The following From address failed: doug@lerner.net : Called Mail() without being connected”

    I am using Gmail Google Apps and have the settings as recommended (in fact exactly as in my mail client):

    smtp.gmail.com
    SSL on
    Authentication: on
    Port 465 (also tried port 587)
    username: my email address
    password: my password

    I’m running WP 3.7.1 and WP-Mail SMTP 0.9.3.

    Any thoughts? The reason I was interested in this is because lately Subscribe2Html which send my posts out doesn’t reach a few Gmail users (including me!), and my hosting site suggested I might try using SMTP instead of the PHP email I have been using.

    Thanks,

    Doug

    • Gmail is funny about relaying messages where the “From” address doesn’t match your gmail address. I think it just changes the from address, or maybe it doesn’t allow the messages. Are you using two factor authentication? If the SMTP settings are correct, and any mails get through, the issue lies with the mail server. Otherwise, maybe your web server doesn’t allow outgoing connections.

      • Thanks for your response. In my case, the Gmail address and the from address are the same – just my personal email address.

        I am not using two-factor authentication. Just ordinary username and password.

        Note that with the plugin turned off, email sent from my WP blog generally works ok. But there are a few addresses (including my own!) which simply do not receive the mail. So it was suggested by various people, including my web host, that I try to relay via an SMTP server instead, as your plugin does.

        So you think I should ask the host of my web server if outgoing connections are being disallowed?

        Thanks,

        Doug

      • A followup. I had my web host provider look at it. They tweaked permissions or whatever on their end, but were not able to get it to work.

        However, if I switch the setting to “Use PHP Mail” it does work.

        But is there any point in doing that? Doesn’t that mean I’m back to where I started and not using SMTP at all?

        Thanks,

        Doug

        • If you use the mail() setting, you can still use the from name and email settings, but the rest is ignored. You’re probably back to the position you were in before you started in terms of jail delivery, yes.

          • Interesting. What I am seeing is:

            (1) With your plugin enabled and PHP mail selected this time the mail that was not arriving at my personal address is arriving. So something about your plugin is helping, even though SMTP is not selected.

            (2) However, the from name I selected in your plugin “Doug’s Blog” is not name on the sent mails. The name on the sent mails is just “doug”.

            I’m confused. :)

            doug

  8. Putting aside sending via Gmail for the moment, I changed the settings to use SMTP again, and am sending them through a “regular” hosted SMTP server for another account I have.

    This time sending via SMTP works.

    But I’m back with the original problem I had when I began looking at SMTP plugins. For some reason, everybody gets my blog notices except my mother and sister. The three of us are in a Gmail apps account with a private domain (my lerner.net domain). My notifications arrive, but theirs just don’t. They aren’t in spam either. My web host looked at the logs and they show they are being delivered.

    I was hoping that using this would help solve this problem, which I think was caused by PHP mail, but I guess it doesn’t.

    Any tips-or-tricks you can think of?

    Thanks,

    Doug

    • Sorry, thought I’d replied to this already. You’re sending emails via Google’s SMTP server’s and you’re using authentication? Or you’re sending via your hosting company’s SMTP servers? If the from address is your Google Apps address, then that might explain why the notifications reach you but not the other addresses.

      Did you find a solution in the end?

      • Hi. No, I never found a solution in the end. I can’t send from my blog via SMTP using the Gmail servers. And my mother and sister don’t receive my blog notifications – though some other people who use Gmail do.

        It remains a mystery to me.

        Thanks,

        doug

  9. Hello, I am trying to get my website to send emails from my gmail account, it seems impossible, I know my host is blocking because of “spoofing” and when I try to send through SMTP i get

    SMTP -> ERROR: Failed to connect to server: Connection timed out (110)

    I am 99.9% sure my settings are correct, could it be that the host is blocking port 587 for gmail?

    • Word of warning, Gmail will force the “From” address to be your Gmail address, no matter what. So you can’t send an email to you that appears to be “From” somebody else (via a contact form for example).

      Could be that your host blocks the port. Or maybe blocks all outgoing connections. Google’s SMTP servers require SSL, so it’s also worth checking that your server supports outgoing connections over SSL.

  10. Hi Callum,

    I am using Gravity Forms ver 3.2 on a website which uses notifications to send out PDF files of the application sent to the Admin and the User. We installed your plugin and it still does not work. See below:

    SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP? (0)

    Where would I make that correction

  11. If I use the plugin for multisite, should I also update these manually?:?
    ====
    global $wpms_options; // This is horrible, should be cleaned up at some point
    $wpms_options = array (
    ‘mail_from’ => ”,
    ‘mail_from_name’ => ”,
    ‘mailer’ => ‘smtp’,
    ‘mail_set_return_path’ => ‘false’,
    ‘smtp_host’ => ‘localhost’,
    ‘smtp_port’ => ’25′,
    ‘smtp_ssl’ => ‘none’,
    ‘smtp_auth’ => false,
    ‘smtp_user’ => ”,
    ‘smtp_pass’ => ”
    ====

  12. wp_mail interception not working; but test mail is using WP Mail SMTP settings.

    Dear callum,

    it seems that even though the test mail feature uses the settings from the plugin, a wp_mail call is not altered; it still sends mail directly to PHP mail() function …

    Any ideas?

  13. I am trying to use wp-mail-smtp on a WordPress network. Your documentation says “put your settings in wp-config.php and then disable the admin menu”. How is this done?

      • Hi there! Same here, couldn’t find the settings for wp-config.php anywhere, then started browsing the source for the plugin and found them there. Might be helpful to include those on the plugin install or FAQ page. :-)
        Great plugin! Using it with Mandrill with no problems.

  14. Please, could you hide the password by default? Maybe using a password field instead of a text field. I don’t know…

  15. Hello I have downloaded and installed “visual form builder” and WP Mail SMTP v0.8. They both are great!, thank you for working on this plugging!. I just have a little bit of a thing, whenever I try the plugging it works perfect but send the e-mail to the dashboard under forms. I need it to send it to l.gutierrez@multilingualgroup.com. How can I do that?, thank you so much. I understand you are busy. But youtrhelp on this will mean a lot for me. Thank you and have a great day!

    • I’m not sure what you’re trying to do. This plugin does not change who messages are sent to, that’s down to whatever form plugin you’re using.

  16. Hi Callum,

    I really need your help (happy to pay).

    I installed http://wordpress.org/plugins/wp-mail-smtp/ onto my 3.7.1 version of WP because I use gravity forms and it recommended I get SMTP for WP in order to send notifications. It installed fine, and I configured the settings but on sending the test email it crashed the site into a 500 error.

    My site came back online by itself 2 minutes later, but now runs REALLY slow, almost backwards. I’m now panicking because my business relies on the site and if its not working properly we’re in trouble!!!! Stupidly i hadn’t done a backup before installing and cant afford to go back a month to the last backup.

    Can you please help me work out what has happened?!!

    Happy to pay for a fix as need this doing ASAP

    Many thanks

    Pete

    • Uninstall the plugin. If your sites goes back to being “fast”, then your problem is solved. If not, the problem lies somewhere else than in the plugin. It’s virtually impossible that this plugin causes your site to load slowly, but that’s the surest way to figure out if it is.

  17. Hi, I just started using your plugin and it’s great. I’m not sure if this has already been answered somewhere, but I would like to change the content of the email that is sent. It may be beyond the scope of your plugin, but do you know a way to accomplish this?

    Thanks!

  18. Hi Callum,

    Your plugin does not authenticate with my smtp server and instead produces the error “fputs() expects parameter 1 to be resource, integer given in class-smtp.php in line 308″

    I use have installed version 0.9.4 of your wp-mail-smpt plugin and I run PHP Version 5.3.27.

    Could you please help me? I use your plugin to enable registration for a design competition and we have over 700 designers registered who try to send emails using our WP form.

    Many thanks in advance!
    Rogier

    • Sounds like your server doesn’t have the correct PHP options enabled. I guess that the error means your server can’t connect.

  19. I tested the contact form but it gives me this message: An error occured – your message has not been sent. Please try again.

    I checked with the web server and they said the SMTP details are all working properly and that the contact form settings is the one that needs fixing. Help!

    • Not sure what the issue is, doesn’t sound like this plugin. Maybe find more information about what the error message means on the contact form plugin.

  20. Hello. I’m hoping someone can shed some insight into an issue I’ve been encountering. When new members register, they don’t receive their password. The only way around this is using the “Forgot Password” function (after which the new password link is successfully sent to users). Could this be a plugin issue on WP Mail SMTP’s end? I tried sending myself a test email and it went through immediately with no errors, but I wanted to throw this out there in case others have experienced this issue.

    Thanks in advance!

  21. hello

    how do I setup the reply to correctly? it’s sending my message back to me when i reply the contact form.

  22. Hi I am getting the following error when trying to sign up with gmail!
    The error result was:

    bool(false)
    The full debugging output is shown below:
    object(PHPMailer)#959 (65) {
    ["Priority"]=>
    int(3)
    ["CharSet"]=>
    string(5) “UTF-8″
    ["ContentType"]=>
    string(10) “text/plain”
    ["Encoding"]=>
    string(4) “8bit”
    ["ErrorInfo"]=>
    string(43) “SMTP Error: Could not connect to SMTP host.”
    ["From"]=>
    string(23) “my gmail email address went here”
    ["FromName"]=>
    string(24) “Hire My Wedding Supplier”
    ["Sender"]=>
    string(0) “”
    ["ReturnPath"]=>
    string(0) “”
    ["Subject"]=>
    string(52) “WP Mail SMTP: Test mail to my email address went here”
    ["Body"]=>
    string(68) “This is a test email generated by the WP Mail SMTP WordPress plugin.”
    ["AltBody"]=>
    string(0) “”
    ["MIMEBody":protected]=>
    string(69) “This is a test email generated by the WP Mail SMTP WordPress plugin.

    ["MIMEHeader":protected]=>
    string(483) “Date: Wed, 19 Mar 2014 14:10:53 +0000
    Return-Path: my gmail email address went here
    To: my email address went here
    From: Hire My Wedding Supplier
    Subject: WP Mail SMTP: Test mail to my email address went here
    Message-ID:
    X-Priority: 3
    X-Mailer: PHPMailer 5.2.4 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
    MIME-Version: 1.0
    Content-Transfer-Encoding: 8bit
    Content-Type: text/plain; charset=UTF-8


    ["mailHeader":protected]=>
    string(0) “”
    ["WordWrap"]=>
    int(0)
    ["Mailer"]=>
    string(4) “smtp”
    ["Sendmail"]=>
    string(18) “/usr/sbin/sendmail”
    ["UseSendmailOptions"]=>
    bool(true)
    ["PluginDir"]=>
    string(0) “”
    ["ConfirmReadingTo"]=>
    string(0) “”
    ["Hostname"]=>
    string(22) “www.hiremysupplier.com”
    ["MessageID"]=>
    string(0) “”
    ["MessageDate"]=>
    string(0) “”
    ["Host"]=>
    string(14) “smtp.gmail.com”
    ["Port"]=>
    string(3) “465″
    ["Helo"]=>
    string(0) “”
    ["SMTPSecure"]=>
    string(3) “ssl”
    ["SMTPAuth"]=>
    bool(true)
    ["Username"]=>
    string(23) “my gmail address went here”
    ["Password"]=>
    string(10) “my gmail password went here”
    ["AuthType"]=>
    string(0) “”
    ["Realm"]=>
    string(0) “”
    ["Workstation"]=>
    string(0) “”
    ["Timeout"]=>
    int(10)
    ["SMTPDebug"]=>
    bool(true)
    ["Debugoutput"]=>
    string(4) “echo”
    ["SMTPKeepAlive"]=>
    bool(false)
    ["SingleTo"]=>
    bool(false)
    ["SingleToArray"]=>
    array(0) {
    }
    ["LE"]=>
    string(1) ”

    ["DKIM_selector"]=>
    string(0) “”
    ["DKIM_identity"]=>
    string(0) “”
    ["DKIM_passphrase"]=>
    string(0) “”
    ["DKIM_domain"]=>
    string(0) “”
    ["DKIM_private"]=>
    string(0) “”
    ["action_function"]=>
    string(0) “”
    ["Version"]=>
    string(5) “5.2.4″
    ["XMailer"]=>
    string(0) “”
    ["smtp":protected]=>
    object(SMTP)#961 (11) {
    ["SMTP_PORT"]=>
    int(25)
    ["CRLF"]=>
    string(2) ”

    ["do_debug"]=>
    bool(true)
    ["Debugoutput"]=>
    string(4) “echo”
    ["do_verp"]=>
    bool(false)
    ["Timeout"]=>
    int(10)
    ["Timelimit"]=>
    int(30)
    ["Version"]=>
    string(5) “5.2.4″
    ["smtp_conn":"SMTP":private]=>
    bool(false)
    ["error":"SMTP":private]=>
    array(1) {
    ["error"]=>
    string(38) “Called Reset() without being connected”
    }
    ["helo_rply":"SMTP":private]=>
    NULL
    }
    ["to":protected]=>
    array(1) {
    [0]=>
    array(2) {
    [0]=>
    string(25) “my email address went here”
    [1]=>
    string(0) “”
    }
    }
    ["cc":protected]=>
    array(0) {
    }
    ["bcc":protected]=>
    array(0) {
    }
    ["ReplyTo":protected]=>
    array(0) {
    }
    ["all_recipients":protected]=>
    array(1) {
    ["my email address went here"]=>
    bool(true)
    }
    ["attachment":protected]=>
    array(0) {
    }
    ["CustomHeader":protected]=>
    array(0) {
    }
    ["message_type":protected]=>
    string(5) “plain”
    ["boundary":protected]=>
    array(3) {
    [1]=>
    string(35) “b1_1c924626f1f5f671635ff7d1a9d9a4e4″
    [2]=>
    string(35) “b2_1c924626f1f5f671635ff7d1a9d9a4e4″
    [3]=>
    string(35) “b3_1c924626f1f5f671635ff7d1a9d9a4e4″
    }
    ["language":protected]=>
    array(18) {
    ["authenticate"]=>
    string(35) “SMTP Error: Could not authenticate.”
    ["connect_host"]=>
    string(43) “SMTP Error: Could not connect to SMTP host.”
    ["data_not_accepted"]=>
    string(30) “SMTP Error: Data not accepted.”
    ["empty_message"]=>
    string(18) “Message body empty”
    ["encoding"]=>
    string(18) “Unknown encoding: ”
    ["execute"]=>
    string(19) “Could not execute: ”
    ["file_access"]=>
    string(23) “Could not access file: ”
    ["file_open"]=>
    string(33) “File Error: Could not open file: ”
    ["from_failed"]=>
    string(35) “The following From address failed: ”
    ["instantiate"]=>
    string(36) “Could not instantiate mail function.”
    ["invalid_address"]=>
    string(15) “Invalid address”
    ["mailer_not_supported"]=>
    string(25) ” mailer is not supported.”
    ["provide_address"]=>
    string(54) “You must provide at least one recipient email address.”
    ["recipients_failed"]=>
    string(45) “SMTP Error: The following recipients failed: ”
    ["signing"]=>
    string(15) “Signing Error: ”
    ["smtp_connect_failed"]=>
    string(22) “SMTP Connect() failed.”
    ["smtp_error"]=>
    string(19) “SMTP server error: ”
    ["variable_set"]=>
    string(30) “Cannot set or reset variable: ”
    }
    ["error_count":protected]=>
    int(2)
    ["sign_cert_file":protected]=>
    string(0) “”
    ["sign_key_file":protected]=>
    string(0) “”
    ["sign_key_pass":protected]=>
    string(0) “”
    ["exceptions":protected]=>
    bool(true)
    }
    The SMTP debugging output is shown below:
    SMTP -> ERROR: Failed to connect to server: Connection refused (111)

  23. Test Message Sent
    I am using wordpress 3.8.1

    The result was:
    bool(false)
    The full debugging output is shown below:
    object(PHPMailer)#229 (65) {
    ["Priority"]=>
    int(3)
    ["CharSet"]=>
    string(5) “UTF-8″
    ["ContentType"]=>
    string(10) “text/plain”
    ["Encoding"]=>
    string(4) “8bit”
    ["ErrorInfo"]=>
    string(43) “SMTP Error: Could not connect to SMTP host.”
    ["From"]=>
    string(18) “atul7173@gmail.com”
    ["FromName"]=>
    string(4) “Atul”
    ["Sender"]=>
    string(0) “”
    ["ReturnPath"]=>
    string(0) “”
    ["Subject"]=>
    string(45) “WP Mail SMTP: Test mail to atul7173@gmail.com
    ["Body"]=>
    string(68) “This is a test email generated by the WP Mail SMTP WordPress plugin.”
    ["AltBody"]=>
    string(0) “”
    ["MIMEBody":protected]=>
    string(69) “This is a test email generated by the WP Mail SMTP WordPress plugin.

    ["MIMEHeader":protected]=>
    string(425) “Date: Wed, 2 Apr 2014 12:00:47 +0000
    Return-Path: atul7173@gmail.com
    To: atul7173@gmail.com
    From: Atul
    Subject: WP Mail SMTP: Test mail to atul7173@gmail.com
    Message-ID:
    X-Priority: 3
    X-Mailer: PHPMailer 5.2.4 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
    MIME-Version: 1.0
    Content-Transfer-Encoding: 8bit
    Content-Type: text/plain; charset=UTF-8


    ["mailHeader":protected]=>
    string(0) “”
    ["WordWrap"]=>
    int(0)
    ["Mailer"]=>
    string(4) “smtp”
    ["Sendmail"]=>
    string(18) “/usr/sbin/sendmail”
    ["UseSendmailOptions"]=>
    bool(true)
    ["PluginDir"]=>
    string(0) “”
    ["ConfirmReadingTo"]=>
    string(0) “”
    ["Hostname"]=>
    string(0) “”
    ["MessageID"]=>
    string(0) “”
    ["MessageDate"]=>
    string(0) “”
    ["Host"]=>
    string(9) “localhost”
    ["Port"]=>
    string(2) “25″
    ["Helo"]=>
    string(0) “”
    ["SMTPSecure"]=>
    string(3) “ssl”
    ["SMTPAuth"]=>
    bool(true)
    ["Username"]=>
    string(18) “atul7173@gmail.com”
    ["Password"]=>
    string(3) “123″
    ["AuthType"]=>
    string(0) “”
    ["Realm"]=>
    string(0) “”
    ["Workstation"]=>
    string(0) “”
    ["Timeout"]=>
    int(10)
    ["SMTPDebug"]=>
    bool(true)
    ["Debugoutput"]=>
    string(4) “echo”
    ["SMTPKeepAlive"]=>
    bool(false)
    ["SingleTo"]=>
    bool(false)
    ["SingleToArray"]=>
    array(0) {
    }
    ["LE"]=>
    string(1) ”

    ["DKIM_selector"]=>
    string(0) “”
    ["DKIM_identity"]=>
    string(0) “”
    ["DKIM_passphrase"]=>
    string(0) “”
    ["DKIM_domain"]=>
    string(0) “”
    ["DKIM_private"]=>
    string(0) “”
    ["action_function"]=>
    string(0) “”
    ["Version"]=>
    string(5) “5.2.4″
    ["XMailer"]=>
    string(0) “”
    ["smtp":protected]=>
    object(SMTP)#294 (11) {
    ["SMTP_PORT"]=>
    int(25)
    ["CRLF"]=>
    string(2) ”

    ["do_debug"]=>
    bool(true)
    ["Debugoutput"]=>
    string(4) “echo”
    ["do_verp"]=>
    bool(false)
    ["Timeout"]=>
    int(10)
    ["Timelimit"]=>
    int(30)
    ["Version"]=>
    string(5) “5.2.4″
    ["smtp_conn":"SMTP":private]=>
    bool(false)
    ["error":"SMTP":private]=>
    array(1) {
    ["error"]=>
    string(38) “Called Reset() without being connected”
    }
    ["helo_rply":"SMTP":private]=>
    NULL
    }
    ["to":protected]=>
    array(1) {
    [0]=>
    array(2) {
    [0]=>
    string(18) “atul7173@gmail.com”
    [1]=>
    string(0) “”
    }
    }
    ["cc":protected]=>
    array(0) {
    }
    ["bcc":protected]=>
    array(0) {
    }
    ["ReplyTo":protected]=>
    array(0) {
    }
    ["all_recipients":protected]=>
    array(1) {
    ["atul7173@gmail.com"]=>
    bool(true)
    }
    ["attachment":protected]=>
    array(0) {
    }
    ["CustomHeader":protected]=>
    array(0) {
    }
    ["message_type":protected]=>
    string(5) “plain”
    ["boundary":protected]=>
    array(3) {
    [1]=>
    string(35) “b1_758f04117597ad9f60a7f344fba82a54″
    [2]=>
    string(35) “b2_758f04117597ad9f60a7f344fba82a54″
    [3]=>
    string(35) “b3_758f04117597ad9f60a7f344fba82a54″
    }
    ["language":protected]=>
    array(18) {
    ["authenticate"]=>
    string(35) “SMTP Error: Could not authenticate.”
    ["connect_host"]=>
    string(43) “SMTP Error: Could not connect to SMTP host.”
    ["data_not_accepted"]=>
    string(30) “SMTP Error: Data not accepted.”
    ["empty_message"]=>
    string(18) “Message body empty”
    ["encoding"]=>
    string(18) “Unknown encoding: ”
    ["execute"]=>
    string(19) “Could not execute: ”
    ["file_access"]=>
    string(23) “Could not access file: ”
    ["file_open"]=>
    string(33) “File Error: Could not open file: ”
    ["from_failed"]=>
    string(35) “The following From address failed: ”
    ["instantiate"]=>
    string(36) “Could not instantiate mail function.”
    ["invalid_address"]=>
    string(15) “Invalid address”
    ["mailer_not_supported"]=>
    string(25) ” mailer is not supported.”
    ["provide_address"]=>
    string(54) “You must provide at least one recipient email address.”
    ["recipients_failed"]=>
    string(45) “SMTP Error: The following recipients failed: ”
    ["signing"]=>
    string(15) “Signing Error: ”
    ["smtp_connect_failed"]=>
    string(22) “SMTP Connect() failed.”
    ["smtp_error"]=>
    string(19) “SMTP server error: ”
    ["variable_set"]=>
    string(30) “Cannot set or reset variable: ”
    }
    ["error_count":protected]=>
    int(2)
    ["sign_cert_file":protected]=>
    string(0) “”
    ["sign_key_file":protected]=>
    string(0) “”
    ["sign_key_pass":protected]=>
    string(0) “”
    ["exceptions":protected]=>
    bool(true)
    }
    The SMTP debugging output is shown below:
    SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP? (113983616)

  24. Hello,

    I’m getting the same failure to connect messages with both of my SMTP servers (1 with google, 1 with fastmail).

    I have verified that I have the SMTP info correct and they are otherwise working. I’ve also made sure the From name matches the email, etc. Still no luck.

    I’d appreciate any help you can offer.

    I’ve pasted below the Test message results.

    Thanks
    ==========

    Test Message Sent
    The result was:
    bool(false)
    The full debugging output is shown below:
    object(PHPMailer)#835 (65) {
    ["Priority"]=>
    int(3)
    ["CharSet"]=>
    string(5) “UTF-8″
    ["ContentType"]=>
    string(10) “text/plain”
    ["Encoding"]=>
    string(4) “8bit”
    ["ErrorInfo"]=>
    string(43) “SMTP Error: Could not connect to SMTP host.”
    ["From"]=>
    string(16) “zt@twistmail.net”
    ["FromName"]=>
    string(13) “Zachary Twist”
    ["Sender"]=>
    string(0) “”
    ["ReturnPath"]=>
    string(0) “”
    ["Subject"]=>
    string(45) “WP Mail SMTP: Test mail to list@mailworks.org
    ["Body"]=>
    string(68) “This is a test email generated by the WP Mail SMTP WordPress plugin.”
    ["AltBody"]=>
    string(0) “”
    ["MIMEBody:protected"]=>
    string(69) “This is a test email generated by the WP Mail SMTP WordPress plugin.

    ["MIMEHeader:protected"]=>
    string(440) “Date: Fri, 4 Apr 2014 19:15:15 +0000
    Return-Path: zt@twistmail.net
    To: list@mailworks.org
    From: Zachary Twist
    Subject: WP Mail SMTP: Test mail to list@mailworks.org
    Message-ID:
    X-Priority: 3
    X-Mailer: PHPMailer 5.2.4 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
    MIME-Version: 1.0
    Content-Transfer-Encoding: 8bit
    Content-Type: text/plain; charset=UTF-8


    ["mailHeader:protected"]=>
    string(0) “”
    ["WordWrap"]=>
    int(0)
    ["Mailer"]=>
    string(4) “smtp”
    ["Sendmail"]=>
    string(18) “/usr/sbin/sendmail”
    ["UseSendmailOptions"]=>
    bool(true)
    ["PluginDir"]=>
    string(0) “”
    ["ConfirmReadingTo"]=>
    string(0) “”
    ["Hostname"]=>
    string(0) “”
    ["MessageID"]=>
    string(0) “”
    ["MessageDate"]=>
    string(0) “”
    ["Host"]=>
    string(24) “mail.messagingengine.com”
    ["Port"]=>
    string(3) “465″
    ["Helo"]=>
    string(0) “”
    ["SMTPSecure"]=>
    string(3) “ssl”
    ["SMTPAuth"]=>
    bool(true)
    ["Username"]=>
    string(16) “zt@twistmail.net”
    ["Password"]=>
    string(13) “*******”
    ["AuthType"]=>
    string(0) “”
    ["Realm"]=>
    string(0) “”
    ["Workstation"]=>
    string(0) “”
    ["Timeout"]=>
    int(10)
    ["SMTPDebug"]=>
    bool(true)
    ["Debugoutput"]=>
    string(4) “echo”
    ["SMTPKeepAlive"]=>
    bool(false)
    ["SingleTo"]=>
    bool(false)
    ["SingleToArray"]=>
    array(0) {
    }
    ["LE"]=>
    string(1) ”

    ["DKIM_selector"]=>
    string(0) “”
    ["DKIM_identity"]=>
    string(0) “”
    ["DKIM_passphrase"]=>
    string(0) “”
    ["DKIM_domain"]=>
    string(0) “”
    ["DKIM_private"]=>
    string(0) “”
    ["action_function"]=>
    string(0) “”
    ["Version"]=>
    string(5) “5.2.4″
    ["XMailer"]=>
    string(0) “”
    ["smtp:protected"]=>
    object(SMTP)#821 (11) {
    ["SMTP_PORT"]=>
    int(25)
    ["CRLF"]=>
    string(2) ”

    ["do_debug"]=>
    bool(true)
    ["Debugoutput"]=>
    string(4) “echo”
    ["do_verp"]=>
    bool(false)
    ["Timeout"]=>
    int(10)
    ["Timelimit"]=>
    int(30)
    ["Version"]=>
    string(5) “5.2.4″
    ["smtp_conn:private"]=>
    bool(false)
    ["error:private"]=>
    array(1) {
    ["error"]=>
    string(38) “Called Reset() without being connected”
    }
    ["helo_rply:private"]=>
    NULL
    }
    ["to:protected"]=>
    array(1) {
    [0]=>
    array(2) {
    [0]=>
    string(18) “list@mailworks.org”
    [1]=>
    string(0) “”
    }
    }
    ["cc:protected"]=>
    array(0) {
    }
    ["bcc:protected"]=>
    array(0) {
    }
    ["ReplyTo:protected"]=>
    array(0) {
    }
    ["all_recipients:protected"]=>
    array(1) {
    ["list@mailworks.org"]=>
    bool(true)
    }
    ["attachment:protected"]=>
    array(0) {
    }
    ["CustomHeader:protected"]=>
    array(0) {
    }
    ["message_type:protected"]=>
    string(5) “plain”
    ["boundary:protected"]=>
    array(3) {
    [1]=>
    string(35) “b1_78212b24715d38a90793ffe9af897f49″
    [2]=>
    string(35) “b2_78212b24715d38a90793ffe9af897f49″
    [3]=>
    string(35) “b3_78212b24715d38a90793ffe9af897f49″
    }
    ["language:protected"]=>
    array(18) {
    ["authenticate"]=>
    string(35) “SMTP Error: Could not authenticate.”
    ["connect_host"]=>
    string(43) “SMTP Error: Could not connect to SMTP host.”
    ["data_not_accepted"]=>
    string(30) “SMTP Error: Data not accepted.”
    ["empty_message"]=>
    string(18) “Message body empty”
    ["encoding"]=>
    string(18) “Unknown encoding: ”
    ["execute"]=>
    string(19) “Could not execute: ”
    ["file_access"]=>
    string(23) “Could not access file: ”
    ["file_open"]=>
    string(33) “File Error: Could not open file: ”
    ["from_failed"]=>
    string(35) “The following From address failed: ”
    ["instantiate"]=>
    string(36) “Could not instantiate mail function.”
    ["invalid_address"]=>
    string(15) “Invalid address”
    ["mailer_not_supported"]=>
    string(25) ” mailer is not supported.”
    ["provide_address"]=>
    string(54) “You must provide at least one recipient email address.”
    ["recipients_failed"]=>
    string(45) “SMTP Error: The following recipients failed: ”
    ["signing"]=>
    string(15) “Signing Error: ”
    ["smtp_connect_failed"]=>
    string(22) “SMTP Connect() failed.”
    ["smtp_error"]=>
    string(19) “SMTP server error: ”
    ["variable_set"]=>
    string(30) “Cannot set or reset variable: ”
    }
    ["error_count:protected"]=>
    int(2)
    ["sign_cert_file:protected"]=>
    string(0) “”
    ["sign_key_file:protected"]=>
    string(0) “”
    ["sign_key_pass:protected"]=>
    string(0) “”
    ["exceptions:protected"]=>
    bool(true)
    }
    The SMTP debugging output is shown below:
    SMTP -> ERROR: Failed to connect to server: Connection refused (111)

    • You posted your email address and your password above by the way. I’d suggest changing your password immediately.

      Your web server probably isn’t set up to make outgoing connections, or the specific host you’re trying to access is blocked. Try contacting your server administrator.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>