PHP mail() function help needed.

 
Post new topic   Reply to topic    34SP.com Forum Index // Scripting Support
View previous topic :: View next topic  
Author Message
manish
34SP Newbie
34SP Newbie


Joined: 01 Dec 2011
Posts: 1

PostPosted: Thu Dec 01, 2011 8:27 pm    Post subject: PHP mail() function help needed. Reply with quote
Hello I have a problem with one of my customers websites useing PHP mail() function.

What Happens is this.
I send a message from a form useing this function:

Code:
function sendEmailFullHeaders($from=NULL, $to, $cc, $bcc, $subject, $message)
{
   if(strlen("".$from)==0){
      $from = "bookings@myDomain.org.uk";
   }

   $headers = "From: ".$from."\r\n";
   $headers .= "Cc: ".$cc."\r\n";
   $headers .= "Bcc: ".$bcc."\r\n";   

   mail($to, $subject, $message, $headers);

}



I have also used this one for HTML messages:

Code:
function sendHTMLEmail($from=NULL, $to, $subject, $message)
{
   $imgroot = "http://mydomain.co.uk/bookings/images/";
   if(strlen("".$from)==0){
      $from = "bookings@mydomain.org.uk";
   }

   $headers  = "";
   $headers .= 'MIME-Version: 1.0' . "\n";
   $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
   $headers .= "From: ".$from."\n";
   
   $cmessage  = "";   
   $cmessage .= "<html><head><title>Squeeze</title></head><body>";
   $cmessage .= "<div align='center'><img src='".$imgroot."logo_grey.gif'/><br/></div>";
   $cmessage .= $message;
   $cmessage .= "<div align='center'>". norm("To view or cancel your booking please go to"). "<a href='http://www.mydomain.org.uk/bookings' style='color:#aaaaaa; font-size:16px;'>www.mydomain.org.uk/bookings</a></div>";
   $cmessage .= "<div align='center'><img align='center' src='".$imgroot."sea.jpg'/></div>";
   $cmessage .= "</body></html>";
   
   mail($to, $subject, $cmessage, $headers);
}


The result should look like this.

Quote:
This is Line 1!

This is Line 3!


This is Line 6!


This is Line 9!
This is Line 10!


But instead the result is one long line of text with out line breaks in it.
Only spaces to represent the line breaks like this:

Quote:
This is Line 1! This is Line 3! This is Line 6! This is Line 9! This is Line 10!


This all used to work fine but I dont know why things have changed so suddely.

If I send a plain text message to my Yahoo mail account, the message appears to be formatted correctly but not if I send it useing the HTML format.

The problem mainly affects my Outlook mail of which I have used diferent versions with the same outcome.

I would appriciate any help.
Thanks Manish
Back to top
View user's profile Send private message
Post new topic   Reply to topic    34SP.com Forum Index // Scripting Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Powered by phpBB © 2001, 2002 phpBB Group