By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,985 Members | 1,694 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,985 IT Pros & Developers. It's quick & easy.

smtp email in php not send mail

ditditsasa
P: 17
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
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require("smtp.php");
  3. require("sasl.php"); //SASL authentication
  4. $from="support@yourwebsite.com"; 
  5. $smtp=new smtp_class;
  6. $smtp->host_name="www.website.com"; // Or IP address
  7. $smtp->host_port=25;
  8. $smtp->ssl=0;
  9. $smtp->start_tls=0;
  10. $smtp->localhost="localhost";
  11. $smtp->direct_delivery=0;
  12. $smtp->timeout=10;
  13. $smtp->data_timeout=0;
  14. $smtp->debug=1;
  15. $smtp->html_debug=1;
  16. $smtp->pop3_auth_host="";
  17. $smtp->user="support@website.com"; // SMTP Username
  18. $smtp->realm="";
  19. $smtp->password="password"; // SMTP Password
  20. $smtp->workstation="";
  21. $smtp->authentication_mechanism=""; 
  22.  
  23. if($smtp->SendMessage(
  24. $from,
  25. array(
  26. $to
  27. ),
  28. array(
  29. "From: $from",
  30. "To: $to",
  31. "Subject: $subject",
  32. "Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z")
  33. ),
  34. "$message"))
  35. {
  36. echo "Message sent to $to OK."; 
  37. }
  38. else
  39. echo "Cound not seend the message to $to.\nError: ".$smtp->error;
  40. ?>
  41.  
Apr 21 '12 #1
Share this Question
Share on Google+
1 Reply


harshmaul
Expert 100+
P: 490
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.
May 14 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.