Re: mail() sending in html format (or not)



steve wrote:

look at the examples found on php.net for the mail() function...you'll need to look at the examples that show sending headers...that should get you the rest of the way.


Ah, now I get it.

   $headers  = "MIME-Version: 1.0\n";
   $headers .= "Content-type: text/plain; charset=iso-8859-1\n";
   $headers .= "X-Priority: 3\n";
   $headers .= "X-MSMail-Priority: Normal\n";
   $headers .= "X-Mailer: php\n";
   $headers .= "From: \"".$fromname."\" <".$fromaddress.">\n";

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

So I'll need to separate headers and message. I'm not sure how it would reassemble that though as multi-part. Maybe if I just did a simpler html only content with one header.



if you have access to you smtp server's pick up directory, i'd recommend just writing directly to it with the output.

I'll check. I'm not sure how this would help though.


imho, php has always had weak support for sending email...especially where authentication is concerned. this approach takes a lot of guess work out of the picture. at this point, you be troubleshooting your own pertanent code...get that working and then you could play around with how you want/should be sending the mail based on other constraints you may be under.

Well, I tried it with just one header and I think it's working. Mozilla doesn't really show the html styling but I think that's just following the default display without adding colors & such. When I reply, it shows up as an html table.


For the record, this is what I used (very bare bones):

<?

function html_mail()
{
  global $emailTo;
  global $emailCC;
  $html     = '
            <html>
              <style>
              </style>
              <body>
              ';

    $html   .= '<table>';
    $html   .= '<tr><td>';
    $html   .= "column 1";
    $html   .= '</td>'
                . "\r\n";
    $html   .= '<td>';
    $html   .= "column 2";
    $html   .= '</td></tr></table>'
                . "\r\n";
  $html .= "testing, does the above appear as a table to you
            or plain text?
              </body>
            </html>
           ";
  $mail     = "MIME-Version: 1.0\r\n";
  $mail    .= "FROM: Automated Email <info@xxxxx>\r\n";
  $mail    .= "Subject: Triteleia Order Confirmation \r\n";
  $mail    .= "Content-Type: text/html; charset=us-ascii\r\n";
  $mail    .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
mail($emailTo, "", $html, $mail);
}
  $emailTo = "info@xxxxx";
  html_mail()
?>

.



Relevant Pages

  • Re: convert to html
    ... And the html versions play the same whether ... >>Steve Rindsberg, PPT MVP ...
    (microsoft.public.powerpoint)
  • Re: making it all stick together
    ... you have to edit the html code to get your music to play ... Sounds won't play across multiple slides on the web ... the slides and a short movie in the last slide. ...
    (microsoft.public.powerpoint)
  • Re: convert to html
    ... And the html versions play the same whether ... >downloading before your slide timing takes you to the ... >> the files play in the original ppt file. ...
    (microsoft.public.powerpoint)
  • Re: Mail form adjusting
    ... irritation that you couldn't be bothered to learn just a tiny bit about ... what really is one of the easier languages to play with. ... Is it possible only using html? ...
    (comp.lang.php)
  • Re: convert to html
    ... Each slide has an individual sound file ... This is only the html version. ... > the files play in the original ppt file. ... >>PowePoint to DVD-quality video, PowerPoint to web ...
    (microsoft.public.powerpoint)