smtp email in php not send mail

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ditditsasa
    New Member
    • Mar 2012
    • 17

    smtp email in php not send mail

    hi friends,

    My email sending function display error

    Error: it was not possible to read line from the SMTP server: data access time out

    pls help me
    Code:
    <?php
    require("smtp.php");
    require("sasl.php"); //SASL authentication
    $from="support@yourwebsite.com"; 
    $smtp=new smtp_class;
    $smtp->host_name="www.website.com"; // Or IP address
    $smtp->host_port=25;
    $smtp->ssl=0;
    $smtp->start_tls=0;
    $smtp->localhost="localhost";
    $smtp->direct_delivery=0;
    $smtp->timeout=10;
    $smtp->data_timeout=0;
    $smtp->debug=1;
    $smtp->html_debug=1;
    $smtp->pop3_auth_host="";
    $smtp->user="support@website.com"; // SMTP Username
    $smtp->realm="";
    $smtp->password="password"; // SMTP Password
    $smtp->workstation="";
    $smtp->authentication_mechanism=""; 
    
    if($smtp->SendMessage(
    $from,
    array(
    $to
    ),
    array(
    "From: $from",
    "To: $to",
    "Subject: $subject",
    "Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z")
    ),
    "$message"))
    {
    echo "Message sent to $to OK."; 
    }
    else
    echo "Cound not seend the message to $to.\nError: ".$smtp->error;
    ?>
  • harshmaul
    Recognized Expert Contributor
    • Jul 2007
    • 490

    #2
    Sounds like the SMTP is timing out. perhaps up the smtp->timeout to something like 100 or higher perhaps.

    If it still fails it could be possible that the connection to the smtp you are using is incorrect. You could try using telnet or some other similar tool to see if the smtp server you are trying to connect to is accepting connections from your machine.

    Comment

    Working...