Problems with mail and WIN2K

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lloydie-t
Forum Commoner
Posts: 88
Joined: Thu Jun 27, 2002 3:41 am
Location: UK

Problems with mail and WIN2K

Post by lloydie-t »

I am having desperate problems trying to use the mail function on a WIN2K box. The ODD thing is that the scripts work fine on the ISP *NIX boxes.
I have already set the PHP.INI file so that SMTP is using my ISP server and sendmail_from is set with a valid email address. I have also telneted to the SMTP server from the WIN2K box to check that it is working.
The problem I have is that PHP hangs and I have to close all browser windows using it before i can get back in.

Here is the simple script I am trying to get to work.

Code: Select all

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

$contactname = "Lloyd T"; 
$contactemail = "lloydie-t@plus.com"; 

$message = "hello from  me"; 
$subject = "test from lloyd"; 

$headers .= "MIME-Version: 1.0\r\n"; 
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
$headers .= "From: ".$myname." <".$myemail.">\r\n"; 
$headers .= "To: ".$contactname." <".$contactemail.">\r\n"; 
$headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n"; 
$headers .= "X-Priority: 1\r\n"; 
$headers .= "X-MSMail-Priority: High\r\n"; 
$headers .= "X-Mailer: Just My Server"; 

mail($contactemail, $subject, $message, $headers);
Any Ideas
-------------------------------------------------
WIN2K
PHP 4.3.1
Apache 1.27
MySQL 4.0.4
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

maybe your isp requires some kind of authentication before using the smtp-server. I had trouble with my domain provider's smtp, too. But after finding that they support smtp-after-pop3 I gave up efforts to extend the mail module of php (digest implementation is not for me ;) )
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Have you tried a simple test of the mail() function, something like:

Code: Select all

$to = 'me@mydomain.com';
$subject = 'mail() test';
$msg = 'testing';

mail($to, $subject, $msg);
Mac
lloydie-t
Forum Commoner
Posts: 88
Joined: Thu Jun 27, 2002 3:41 am
Location: UK

Post by lloydie-t »

It seems PHP does not like the ISP SMTP setting. I have installed a SMTP mail server and now use localhost for sending mail. All seems OK so far except that my my main mail() script is not sending even though it is connecting to SMTP. Will have to investigate more, but for this particular problem mail is now working with a local SMTP server.

Thanx
Post Reply