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

mail() connects to SMTP server, but then immediately disconnects

P: 2
HI,
i have a problem similar to this one, but mainly the problem is that my php connects to the mails server, but disconnects immediately.

for example: here is the log of the mail server:

#Software: Microsoft Internet Information Services 6.0
#Version: 1.0
#Date: 2007-08-07 15:00:23
#Fields: date time c-ip s-sitename s-computername s-ip s-port cs-method sc-bytes cs-host
2007-08-07 15:00:23 127.0.0.1 SMTPSVC1 WEBHOST1 127.0.0.1 0 HELO 32 -
2007-08-07 15:00:23 127.0.0.1 SMTPSVC1 WEBHOST1 127.0.0.1 0 MAIL 39 -
2007-08-07 15:00:23 127.0.0.1 SMTPSVC1 WEBHOST1 127.0.0.1 0 RCPT 31 -
2007-08-07 15:00:23 127.0.0.1 SMTPSVC1 WEBHOST1 127.0.0.1 0 RCPT 27 -
2007-08-07 15:00:23 127.0.0.1 SMTPSVC1 WEBHOST1 127.0.0.1 0 QUIT 57 -

in this case the mail() function connected, but no email was sent. then i tried it with outlook express just to check what the log would read, and here is what i got :

#Software: Microsoft Internet Information Services 6.0
#Version: 1.0
#Date: 2007-08-07 14:53:27
#Fields: date time c-ip s-sitename s-computername s-ip s-port cs-method sc-bytes cs-host
2007-08-07 14:53:27 127.0.0.1 SMTPSVC1 WEBHOST1 127.0.0.1 0 HELO 32 -
2007-08-07 14:53:27 127.0.0.1 SMTPSVC1 WEBHOST1 127.0.0.1 0 MAIL 43 -
2007-08-07 14:53:27 127.0.0.1 SMTPSVC1 WEBHOST1 127.0.0.1 0 RCPT 31 -
2007-08-07 14:53:27 127.0.0.1 SMTPSVC1 WEBHOST1 127.0.0.1 0 DATA 125 -
2007-08-07 14:53:27 127.0.0.1 SMTPSVC1 WEBHOST1 127.0.0.1 0 QUIT 57 -
2007-08-07 14:53:27 194.158.37.213 SMTPSVC1 WEBHOST1 - 25 - 30 -
2007-08-07 14:53:27 194.158.37.213 SMTPSVC1 WEBHOST1 - 25 EHLO 4 -
2007-08-07 14:53:27 194.158.37.213 SMTPSVC1 WEBHOST1 - 25 - 55 -
2007-08-07 14:53:27 194.158.37.213 SMTPSVC1 WEBHOST1 - 25 MAIL 4 -
2007-08-07 14:53:27 194.158.37.213 SMTPSVC1 WEBHOST1 - 25 - 12 -
2007-08-07 14:53:27 194.158.37.213 SMTPSVC1 WEBHOST1 - 25 RCPT 4 -
2007-08-07 14:53:27 194.158.37.213 SMTPSVC1 WEBHOST1 - 25 - 12 -
2007-08-07 14:53:27 194.158.37.213 SMTPSVC1 WEBHOST1 - 25 DATA 4 -
2007-08-07 14:53:27 194.158.37.213 SMTPSVC1 WEBHOST1 - 25 - 44 -
2007-08-07 14:53:27 194.158.37.213 SMTPSVC1 WEBHOST1 - 25 - 12 -
2007-08-07 14:53:27 194.158.37.213 SMTPSVC1 WEBHOST1 - 25 QUIT 4 -
2007-08-07 14:53:27 194.158.37.213 SMTPSVC1 WEBHOST1 - 25 - 68 -


which shows that it even connected to the remote server.


anyone has any idea what the problem is? here is the code in use :
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. /*variables*/
  4. $name = $_POST["name"];
  5. $surname = $_POST["surname"];
  6. $sex = $_POST["sex"];
  7. $address = $_POST["address"];
  8. $home = $_POST["home"];
  9. $mobile = $_POST["mobile"];
  10. $email = $_POST["email"];
  11. $dob = $_POST["dob"];
  12. $status = $_POST["status"];
  13. $overseas = $_POST["overseas"];
  14. $from1 = $_POST["from1"];
  15. $to1 = $_POST["to1"];
  16. $company1 = $_POST["company1"];
  17. $position1 = $_POST["position1"];
  18. $res1 = $_POST["res1"];
  19. $from2 = $_POST["from2"];
  20. $to2 = $_POST["to2"];
  21. $company2 = $_POST["company2"];
  22. $position2 = $_POST["position2"];
  23. $res2 = $_POST["res2"];
  24. $other = $_POST["other"];
  25. $cert = $_POST["cert"];
  26. $lang = $_POST["lang"];
  27. $educ = $_POST["educ"];
  28. $comp = $_POST["comp"];
  29. $info = $_POST["info"];
  30. $interests = $_POST["interests"];
  31. $agreement = $_POST["agreement"];
  32. $subject = "Curriculum Vitae of " . $surname .", " .$name ."";
  33.  
  34. /*received email form*/
  35. $message = "Standard Registration Form" . "\n\n";
  36. $message .= "Name: " . $name . "\n";
  37. $message .= "Surname: " . $surname . "\n";
  38. $message .= "Sex: " . $sex . "\n";
  39. $message .= "Address: " . "\n";
  40. $message .= $address . "\n";
  41. $message .= "Home Number: " . $home . "\n";
  42. $message .= "Mobile Phone Number: " . $mobile . "\n";
  43. $message .= "Email Address: " . $email . "\n";
  44. $message .= "Date of Birth: " . $dob . "\n";
  45. $message .= "Status: " . $status . "\n";
  46. $message .= "Willing to Work Overseas: " . $overseas . "\n\n";
  47.  
  48. $message .= "Employment History / Experience" . "\n\n";
  49. $message .= "From: " . $from1 . " To: " . $to1 . "\n";
  50. $message .= "Company: " . $company1 . "\n";
  51. $message .= "Position Held: " . $position1 . "\n";
  52. $message .= "Resposibilities: " . "\n";
  53. $message .= $res1 ."\n\n";
  54.  
  55. $message .= "From: " . $from2 . " To: " . $to2 . "\n";
  56. $message .= "Company: " . $company2 . "\n";
  57. $message .= "Position Held: " . $position2 . "\n";
  58. $message .= "Resposibilities: " . "\n";
  59. $message .= $res2 ."\n\n";
  60.  
  61. $message .= "Other Employment: " . "\n";
  62. $message .= $other ."\n\n";
  63. $message .= "Training and Certificates: " . "\n";
  64. $message .= $cert ."\n\n";
  65. $message .= "Languages: " . "\n";
  66. $message .= $lang ."\n\n";
  67. $message .= "Education History: " . "\n";
  68. $message .= $educ ."\n\n";
  69. $message .= "Computer Skills: " . "\n";
  70. $message .= $comp ."\n\n";
  71. $message .= "Other Information: " . "\n";
  72. $message .= $info ."\n\n";
  73. $message .= "Interests: " . "\n";
  74. $message .= $interests ."\n\n";
  75.  
  76. $message .= "Agreement: " . $agreement . "\n";
  77.  
  78. /*address to whom form will be sent*/
  79. $sendTo = "__MUNGED__";
  80.  
  81. $headers = "From: Contact From <" . $email . ">" . "\r\n" . "Reply-To: " . $email . "\r\n" . "Bcc: " . $Bcc . "\r\n";
  82.  
  83. mail($sendTo, $subject, $message, $headers);
  84.  
  85. /*change this according to page following confirmation of sending of CV*/
  86. header ("Location: home.html")
  87.  
  88. ?>
Aug 7 '07 #1
Share this Question
Share on Google+
2 Replies


pbmods
Expert 5K+
P: 5,821
Heya, bmamo. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

I went ahead and split this off into its own thread so as not to hijack the other poster's problem.
Aug 7 '07 #2

P: 2
i'm sorry.. my bad...

and thanks !
Aug 7 '07 #3

Post your reply

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