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!

fsockopen() error in class.smtp.php

Discussion in 'E-mail Discussion' started by onkar, Dec 13, 2007.

  1. onkar

    onkar Member

    Joined:
    Jul 9, 2007
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    51
    Hello,

    We are facing an issue while sending mails through php script. Following are the error details.

    Warning: fsockopen() [function.fsockopen]: unable to connect to mail.domain.com:25 in /home/user/public_html/mail/class.smtp.php on line 122

    Message was not sent

    Mailer Error: SMTP Error: Could not connect to SMTP host.

    We are using following script for sending mails.

    <?php
    require_once("class.phpmailer.php");
    $mail = new PHPMailer();
    $mail->IsSMTP(); // send via SMTP
    $mail->Host = "mail.domain.com"; // SMTP servers
    #$mail->SMTPAuth = true; // turn on SMTP authentication
    $mail->Username = "user@domain.com"; // SMTP username
    $mail->Password = "xxxx"; // SMTP password
    $mail->From = "user@domain.com";
    $mail->FromName = "user";
    $mail->AddAddress("user@yahoo.com");
    $mail->WordWrap = 50; // set word wrap
    $mail->IsHTML(true); // send as HTML
    $mail->Subject = "Hi";
    $mail->Body = "How are you";
    if(!$mail->Send())
    {
    echo "Message was not sent <p>";
    echo "Mailer Error: " . $mail->ErrorInfo;
    exit;
    }

    echo "Message has been sent";
    ?>

    Please let us know the solution for this error.

    Thanks,
    Onkar
     
  2. LuisMello

    LuisMello Member

    Joined:
    May 30, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    151
    I have the same problem
     
  3. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,567
    Likes Received:
    43
    Trophy Points:
    308
    cPanel Access Level:
    Root Administrator
    Can you telnet to the remote host port 25?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Kailash1

    Kailash1 Well-Known Member

    Joined:
    Nov 27, 2006
    Messages:
    253
    Likes Received:
    2
    Trophy Points:
    168
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hi,

    I have the same problem and I am able to connect to server remotely via telnet using port 25.

    Thanks,

    Kailash
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Kailash1

    Kailash1 Well-Known Member

    Joined:
    Nov 27, 2006
    Messages:
    253
    Likes Received:
    2
    Trophy Points:
    168
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hi,

    I could successfully resolve the issue by downgrading Apache version to 1.3 and PHP version to PHP 4.4.8. I am not sure it was a problem with Apache or PHP version.

    Kailash
     
    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