WordPress.org

Ready to get started?Download WordPress

Forums

Request: Fix class-phpmailer to support SSL connections (4 posts)

  1. bret.miller
    Member
    Posted 5 years ago #

    Please change class-phpmailer in wp-includes to support Google Apps SSL email. In version 2.63, this starts at line 536 and reads:

    if(strstr($hosts[$index], ":"))
                    list($host, $port) = explode(":", $hosts[$index]);
                else
                {
                    $host = $hosts[$index];
                    $port = $this->Port;
                }

    To make it work for Google Apps, it has to support pulling the port off the end, but also allow for ssl:// at the start of the host name because ssl://smtp.gmail.com:465 is what works to connect. So here's what you change it to:

    $i=strrpos($hosts[$index], ":");
        if($i > 0) {
            $host = substr($hosts[$index],0,$i);
            $port = substr($hosts[$index],$i+1,strlen($hosts[$index])-$i);
        }
        else
        {
            $host = $hosts[$index];
            $port = $this->Port;
        }

    Then you can use the wp-mail-smtp plugin to enable SMTP over ssl://smtp.gmail.com:465 and it just works.

    HTH,
    Bret

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Actually, the PHPMailer class supports ssl without that modification. All you have to do is to set $phpmailer->SMTPSecure = "ssl".

    So it sounds like the plugin needs to recognize the SSL prefix, pull that off, and then set the secure option in the phpmailer object accordingly.

  3. bret.miller
    Member
    Posted 5 years ago #

    In what version does that work? A grep of my wordpress files doesn't find "SMTPSecure" in any .php file, and setting it certainly doesn't work for me. It hangs for a bit and says "Called Reset() without being connected".

    [removed debug output]

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Huh. Okay, sorry, I guess I was looking at a newer version that is in WordPress 2.7. I didn't realize that that file had been updated to a later version.

    Anyway, this new version is in WordPress 2.7, and it does work there, so there you go. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.