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.

phpmailer class error send mail

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

  1. diracuser

    diracuser Member

    Joined:
    Oct 22, 2014
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    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 Member

    Joined:
    Oct 22, 2014
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page