Page 1 of 1

Problems sending Html Mail on *NIX server

Posted: Fri May 09, 2003 9:43 pm
by lloydie-t
I have been having great problems using the mail() function on my develoment WIN2K server and now i have it working, when I transfered to script to my ISP's production server it does not work. Basically the html message seems to be snarling it up I dont understand why. Can you help. this is a section of the script.

Code: Select all

$myname = "Touch Support";

$myemail = "support@touch.com";


$contactname = "$uforename $usurname";

$contactemail = "$uemail";

$myreplyemail = "support@touch.com";

if ($mymail == ""){$suppemail = "";}

else

{

$suppname = "$myforename $mysurname";

$suppemail = "$mymail";

$suppemail2 = ",$mymail";

}

if (semail == ""){$engmail = "";}

else

{

$engname = "$sforename $ssurname";

$engmail = "$semail";

$engmail2 = ",$semail"; 

} 

$allmail = "$contactemail $suppemail2 $engmail2 ,$myemail";

$subject = "Job No $job_id has been created";


$message .= (" <HTML>

<BODY>

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>

.................

a whole load of html in between

..............................

</BODY></HTML> ");


$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.">,".$suppname." <".$suppemail.">,".$engname." <".$engmail.">, ".$myname." <".$myemail.">\r\n"; 

$headers .= "Reply-To: ".$myname." <".$myreplyemail.">\r\n"; 

$headers .= "X-Mailer: Touch Support Server\r\n";

$headers .= "x-message-flag: Touch Support\r\n"; 

mail( $allmail, $subject, $message, $headers);
I have already tried messing with \r\n and putting the $message var in single quotes.

The development machine is:
WIN2K
PHP 4.3.1
Apache 1.3.27

The Production machine is:
FreeBSD 4.6.2
PHP 4.2.3
Apache 1.3.27
Can you help? I really dont have a clue on this one.

Posted: Fri May 09, 2003 9:52 pm
by volka
what happens with

Code: Select all

mail( $allmail, $subject, $message, $headers) or die('mail rejected');
?
Does sendmail_path point to the right application and is the mail system set up properly?

Posted: Fri May 09, 2003 10:05 pm
by lloydie-t
Volka,
tried that and no response. It is as though the mail is sent, but it is never recieved. I can only assume that the sendmail Path is set up correctly as more simple scripts work fine and I dont think the hosting company would get it wrong.

Posted: Fri May 09, 2003 10:16 pm
by lloydie-t
Fixed.
UNIX does not like multiple email addresses in To: whereas WIN2K does.
WIN2K does not like cc: header whereas UNIX does.

Posted: Fri May 09, 2003 10:23 pm
by m3mn0n
I hate all thoses stupid mail complications.


:?