Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

phpmailer class error send mail

Discussion in 'E-mail Discussion' started by diracuser, Apr 17, 2015.

  1. diracuser

    diracuser Active Member

    Joined:
    Oct 22, 2014
    Messages:
    40
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hi,
    When I try to send an mail from phpmailer class there is an errror : unable to connect to xxx.xxx.xxx.xxx
    I try to send through external server domian

    The domain has configured a remote server, and I read this link: https://forums.cpanel.net/threads/cannot-send-email-from-php-usin-phpmailer-class.283851/ where it's described that the domain name does not have it's email routing setup properly .... But I checked that my domain is in
    /etc/remotedomains


    This is my php configruation:

    Code:
    <?php
    require("class.phpmailer.php");
    
    
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPAuth = true;
    $mail->Host = "xxx.xxx.xxx.xxx"; // SMTP a utilizar.
    $mail->Username = "[EMAIL]correo@dominio.com[/EMAIL]"; // Correo completo a utilizar
    $mail->Password = "111"; //
    $mail->Port = 25; //
    $mail->From = "[EMAIL]correo@dominio.com[/EMAIL]"; //
    $mail->AddAddress("[EMAIL]correo@dominio.com[/EMAIL]"); //
    $mail->IsHTML(true); //
    $mail->Subject = "Mensaje nuevo desde web.net"; // Este es el titulo del email.
    $body = "Nombre: $nombre.<br /> Teléfono: $telefono.<br /> Email: $correo.<br /> Mensaje: $texto.<br />";
    $mail->Body = $body; //
    $exito = $mail->Send(); //
    ?>
    
    Can anyone help me ?
    Thanks
     
    #1 diracuser, Apr 17, 2015
    Last edited by a moderator: Apr 17, 2015
  2. diracuser

    diracuser Active Member

    Joined:
    Oct 22, 2014
    Messages:
    40
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    IF I disable this option
    Tweak Settings --> Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak) [?]
    then phpmailer works ...

    is there another solution to send email through phpmailer to external server without disable this options?
     
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,423
    Likes Received:
    1,957
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    You can disable the option you referred to, or consider installing a third-party application such as CSF (SMTP_BLOCK) which offers the same type of protection, but with the ability to whitelist certain IP addresses.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice