The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Message was not sent..Mailer error

Discussion in 'E-mail Discussions' started by waqas_websouls, Jan 12, 2015.

  1. waqas_websouls

    PartnerNOC

    Joined:
    Dec 9, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello,

    I am using phpmailer with smtp.gmail.com with authentication but getting this error:

    Message was not sent..Mailer error: SMTP connect() failed.



    Thanks,
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Do you notice any output to /var/log/exim_mainlog when attempting to send the message? What are you using for the "host" setting in your mailer script? Does changing it to "localhost" make a difference?

    Thank you.
     
  3. waqas_websouls

    PartnerNOC

    Joined:
    Dec 9, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Dear,

    Here is my script:

    Code:
    <?php
    require_once('./class.phpmailer.php');
    require_once('./class.smtp.php');
    
    $mail = new PHPMailer();
    $mail->IsSMTP() ;
    $mail->Host = 'smtp.gmail.com';
    
    $mail->Port = 465;
    $mail->SMTPAuth  = true ;
    $mail->SMTPSecure = "ssl";
    $mail->Username = "xyzomair@gmail.com";
    $mail->Password = "password";
    
       
    //build the message
     $mail->IsHTML(true);
    //$mail->From     = "xyzomair@gmail.com";
    $mail->AddAddress("xyzomair@gmail.com");
    $mail->Subject  = "An HTML Message";
    $mail->Body     = "Hello, <b>my friend</b>! \n\n This message uses HTML entities!";
    
    if($mail->Send()) {
      echo 'Message is sent';
    
    } 
    else {
      echo 'Message was not sent..';
     echo 'Mailer error: ' . $mail->ErrorInfo;
    }
    ?>
    
    and exim not generate any log attempting to send the message:


    Thanks,
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page