Ispconfig webmail can send email, but from PHPMailer cannot connect to smtp

Discussion in 'Installation/Configuration' started by JULINT, Nov 13, 2021.

  1. JULINT

    JULINT Member

    Hi,
    I have installed ispconfig , webmail is working .
    But when i am trying to send email from phpmailer.. i got :

    Code:
    PHPMailer\PHPMailer\Exception Object
    (
        [message:protected] => SMTP Error: Could not connect to SMTP host.
        [string:Exception:private] =>
        [code:protected] => 0
        [file:protected] => /var/www/clients/client1/web2/web/vendor/phpmailer/phpmailer/src/PHPMailer.php
        [line:protected] => 2146
        [trace:Exception:private] => Array
            (
                [0] => Array
                    (
                        [file] => /var/www/clients/client1/web2/web/vendor/phpmailer/phpmailer/src/PHPMailer.php
                        [line] => 1970
                        [function] => smtpConnect
                        [class] => PHPMailer\PHPMailer\PHPMailer
                        [type] => ->
                    )

    Here is my server data:
    Code:
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 20.04.3 LTS
    Release:        20.04
    Codename:       focal
    
    Code:
    PHP 7.4.25 (cli) (built: Oct 22 2021 12:34:33) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
        with Zend OPcache v7.4.25, Copyright (c), by Zend Technologies
    
     
  2. JULINT

    JULINT Member

  3. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Test the connection via telnet, and if that works, see if there are any errors in the site error.log.
     
  4. JULINT

    JULINT Member

    I have tested debug on phpmailer , and i got this :

    i am set on phpmailer :
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
    $mail->Host = 'smtp.gmail.com';
    $mail->Port = 587;
    and got result below :


    Code:
    2021-11-13 04:58:51 SERVER -> CLIENT: 220 server3.appindowebcity.com ESMTP Postfix (Ubuntu)
    2021-11-13 04:58:51 CLIENT -> SERVER: EHLO localhost
    2021-11-13 04:59:13 SERVER -> CLIENT:
    2021-11-13 04:59:13 SMTP ERROR: EHLO command failed:
    2021-11-13 04:59:13 SMTP NOTICE: EOF caught while checking if connected
    SMTP Error: Could not connect to SMTP host.
    SMTP Error: Could not connect to SMTP host.
    Message could not be sent. Mailer Error: SMTP Error: Could not connect to SMTP host.
     
  5. JULINT

    JULINT Member

    I mean phpmailer config is :

    Code:
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
    $mail->Host = 'mail.ddcart.com';
    $mail->Port = 587;
    
    and got result :

    Code:
    2021-11-13 04:58:51 SERVER -> CLIENT: 220 server3.appindowebcity.com ESMTP Postfix (Ubuntu)
    2021-11-13 04:58:51 CLIENT -> SERVER: EHLO localhost
    2021-11-13 04:59:13 SERVER -> CLIENT:
    2021-11-13 04:59:13 SMTP ERROR: EHLO command failed:
    2021-11-13 04:59:13 SMTP NOTICE: EOF caught while checking if connected
    SMTP Error: Could not connect to SMTP host.
    SMTP Error: Could not connect to SMTP host.
    Message could not be sent. Mailer Error: SMTP Error: Could not connect to SMTP host.
     
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Like @Jesse Norell wrote:
    Use Internet Search Engines with
    Code:
    test smtp server with telnet
     

Share This Page