Hello,

I have sucessfully got my script working so that I can send plain text emails using the mail($to, $subject, $message, $headers); function.

My issue is purely cosmetic as when I open up the email in say outlook my email is displayed with what looks like tabbed lines and it is basically NOT being displayed as the text is laid out in my script. I tried embedding some html but when I viewed the email in outlook I actually saw the html tags !

Sorry to be vague but I suppose my questions are

1.) Using the mail function is it possible to format the body of my plain text email i.e in the script force carriage returns.

2.) can I embed html in my script to format my email body?

3.) Is there another option?

Again sorry to be vague but I have got so near but yet so far. The damn script does its job but the email looks horrid...

Thankyou in advance.

Rowan

    1) use the "\n" character in your message body string for new lines
    2) have a look at the mail doc page. there are specific examples of sending HTML mail
    3) if you are sending large volumes of mail you might want to consider a PHP class (see PEAR Mail or PHPMailer)

      rowantrimmer;10910648 wrote:

      Sorry to be vague but I suppose my questions are

      1.) Using the mail function is it possible to format the body of my plain text email i.e in the script force carriage returns.

      2.) can I embed html in my script to format my email body?

      3.) Is there another option?

      Thankyou in advance.

      Rowan

      Yes, you can send html-tags you even send a style-sheath.

      $mess = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
      		$mess .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
      		$mess .= "<head>";
      		$mess .= "<style type=\"text/css\">";
      		$mess .= "body {margin:10px;}\n";
      		$mess .= "h1,h2,p {color:#555;}\n";
      		// etc
      		$mess .= "</style>\n";
      		$mess .= "<body>\n";
      		$mess .= "<h1>Headline</h1>\n";
      		$mess .= "\n<p>Plain text</p>";
      		//etc
      		$mess .= "<body>";
      		$mess .= "</html>\n";
      

      Although I haven't seen one there might be mail-readers that doesn't support this.

        Write a Reply...