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



steve wrote:

"paul" <paul@xxxxxxx> wrote in message news:ZeWdncUcV6HS5F7fRVn-gQ@xxxxxxxxxxxxxxxx
| steve wrote:
|
| ...
| >
| > // ok, start paying attention again...
|
|
| Thanks, I will study this.
| Obviously not an easy answer in this case!


actually the answer *is* easy...the problem is in your mail headers and/or your boundry settings (even to the detail of how many \r\n's there are that separate each section. and, if you delete my dynamic html crap, you'd end up with only about 10 lines of pertanent code...much less confusing.

let me know if you need further assistance or of your progress.

Thanks,
I tried to boil it down to something simple here. The main thing I don't get is you used iisMail() and I don't know what that is so I just used mail(), which didn't work <g>.


"Warning: mail() expects at least 3 parameters"

It seems you were somehow building the $html & $text separately, then added the $text into the $html preserving a plain text and html version to send.

"\r\n" must be some special line break???

<?
function html_mail()
{
  global $emailTo;
  global $emailCC;
  $html     = '
            <html>
              <style>
              </style>
              <body>
              ';
  $text     = '';
    $html   .= '<table><tr><td>';
    $text   .= "\r\n\r\n" . "message body here" . "\r\n";
//add content here
    $html   .= $text
    $html   .= '</td></tr></table>'
                . "\r\n";
  $html .= "
              </body>
            </html>
           ";
  $mail     = "MIME-Version: 1.0\r\n";
  $mail    .= "FROM: Automated Email <TheMachine@xxxxxxxxxxx>\r\n";
  $mail    .= "TO: "  . $emailTo . "\r\n";
  $mail    .= "CC: "  . $emailCC  . "\r\n";
  $mail    .= "Subject: Important email for you \r\n";

//  $mail    .= "Content-Type: multipart/related;
//boundary=\"$related\"\r\n\r\n\r\n";
//  $mail    .= "--$related\r\n";

  $mail    .= "Content-Type: multipart/alternative;
boundary=\"$boundry\"\r\n\r\n\r\n";
  $mail    .= "--$boundry\r\n";
  $mail    .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
  $mail    .= "Content-Transfer-Encoding: quoted-printable\r\n\r\n";
  $mail    .= $text . "\r\n\r\n";
  $mail    .= "--$boundry\r\n";

$mail .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
$mail .= "Content-Transfer-Encoding: quoted-printable\r\n\r\n";
$mail .= $html . "\r\n\r\n";
// $mail .= "--$boundry--\r\n\r\n";
// $mail .= "--$related\r\n";
// $mail .= "Content-Type: image/jpeg\r\n";
// $mail .= "Content-ID: logo\r\n";
// $mail .= "Content-Disposition: attachment; filename=\"logo.jpg\"\r\n";
// $mail .= "Content-Transfer-Encoding: base64\r\n\r\n";
// $mail .= $image . "\r\n\r\n";
// $mail .= "--$related--\r\n\r\n";
$mail .= "-- End --\r\n";
// iisMail($mail);
mail($mail);
}


//now use the function
  $emailTo = "them@xxxxxxxxxxxxxx";
  $emailCC = "me@xxxxxxxxxx";
  html_mail()
?>
.



Relevant Pages

  • Re: Puzzle?
    ... > Many thanks for the reply, Steve. ... Messages sent as HTML have a plain text ... >>> And if you Terra Terra not on your side". ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: visited links not changing color
    ... Using HTML, it will. ... Thanx anyway, Steve. ... >> problem in OE and Outlook. ... >>>> Are these in plain text messages or HTML messages or both? ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Puzzle?
    ... Steve. ... Messages sent as HTML have a plain text ... >> Joe Steele ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Word HTML authoring Question
    ... Steve Fulton wrote: ... >> that looks enough like HTML to fool browsers into displaying ... little using FrontPage to clean up some of the crap from WordXP, ... attitude also explains why Microsoft's usually dismal Help is ...
    (microsoft.public.inetsdk.html_authoring)
  • Re: Adding MS Agent Characters to Producer for PowerPoint
    ... > enable me to include the Agent code in that HTML page and I could get the ... I know nada about Agent code or what it might require. ... as Producer converts the PP slides. ... >> Steve Rindsberg, PPT MVP ...
    (microsoft.public.powerpoint)