Page 1 of 1

Problems with mail() and Win2K

Posted: Mon Mar 17, 2003 5:30 pm
by lloydie-t
I am have a problem using the PHP mail function. First of, if I have no destination in the mail function I get a message saying "Bad Mail Address". If I enter a valid email address the PHP session hangs and I have to close the browser down and start again.PHP is running on Win2K with Apache and I know I have the correct setting for SMTP and sendmail_from. There is no value for sendmail_path (as using Win2K) and I can not find where you would set the SMTP port number, but I think in default it is correct at 25. Please find following code.

Code: Select all

$myname = "Touch Support";
$myemail = "support@touch.com";

$contactname = "$uforename $usurname";
$contactemail = "$uemail";
$myreplyemail = "support@touch.com";

$suppname = "$myforename $mysurname";
$suppemail = "$mymail";

$engname = "$sforename $ssurname";
$engmail = "$semail";

$message = "Job No: $job_id has been created\n<br>";
$message .= "Date and time created: $action_time\n<br>";
$subject = "Job No $job_id has been created";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "From: ".$myname."<".$myemail.">\r\n";
$headers .= "To: ".$contactname."<".$contactemail.">\r\n";
$headers .= "cc: ".$myname."<".$myemail.">, ".$suppname."<".$suppemail.">, ".$engname."<".$engmail.">\r\n";
$headers .= "Reply-To: ".$myname."<".$myreplyemail.">r\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: Touch server\n";
//following is offeding line
mail("", $subject, $message, $headers);

//if I put an email address in the mail function PHP stops
mail($contactemail, $subject, $message, $headers);
This problem is only on my production server. Using my ISP's Linux server there is no problem.
Any Ideas

Posted: Tue Mar 18, 2003 2:00 am
by twigletmac
Have you tried sending a simple e-mail with no additional headers?

Mac

Posted: Tue Mar 18, 2003 3:08 am
by lloydie-t
Yeah, already tried that using the following.
I am sure the problem is with th php server itself. Might consider going to 4.3.1, but dont know how to upgrade. I am currently running 4.2.3 which was installed using e-PHP installer.

Code: Select all

<?php
		mail(lloydie-t@thomasclan.plus.com, This is a test, Test email from PHP);
echo "test OK";
?>
thanx

Posted: Tue Mar 18, 2003 3:09 am
by twigletmac
Did you really do the test without any quotes around the strings? If so try:

Code: Select all

mail('lloydie-t@thomasclan.plus.com', 'This is a test', 'Test email from PHP');
Mac

Posted: Tue Mar 18, 2003 3:18 am
by lloydie-t
Sorry at the time I was desperate, so as well as trying with quotes I tried without. Silly really. Anyway both had the same effect, the PHP session hangs.

Posted: Tue Mar 18, 2003 7:28 am
by lloydie-t
As well as Linux, I have now tried it on a freeBSD isp server. works fine on those, just cant get it to work on Win2K PHP. Any other ideas