Problems sending Html Mail on *NIX server

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 sending Html Mail on *NIX server

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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?
lloydie-t
Forum Commoner
Posts: 88
Joined: Thu Jun 27, 2002 3:41 am
Location: UK

Post 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.
lloydie-t
Forum Commoner
Posts: 88
Joined: Thu Jun 27, 2002 3:41 am
Location: UK

Post 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.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

I hate all thoses stupid mail complications.


:?
Post Reply