Forum Moderators: coopster
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "\r\nContent-Type: Multipart/alternative;
type of scripting but am not having any luck.
Can somebody help with any better ideas ?
(I wish I can use if else clause..but don't know if there is a way to find out the 'choice' of mail clients ? )
...give freedom to mail client to choose weather it likes text or html(as per user pref)
A little confused, user pref on your system or their preferences? If on your system, easy, when you send, swap between plain text or HTML, but if on their system - I have heard and seen MANY solutions that purport to allow the mail client to decide whether to display text or HTML and have never seen it work under all clients (which doesn't mean it doesn't exist . . . . just all the ones I've tried have failed.)
I want to be able to compose one hybrid kind of email
However, this will always work, it just has a little caveat for text-only clients. Output the text/html headers like you normally do. Text clients ignore or entity-ize HTML, right? Based on that, your body now becomes
<!--
If you are seeing this message, your mail program only accepts plain text messages. For a better experience, please configure your mail program to accept html messages from this web site. You may ignore any html code you see below.
THIS IS YOUR PLAIN TEXT BODY
ETC.
-->
<html><head><title>My Subject</title></head><body>
<p>THIS IS YOUR HTML BODY</p>
<p>ETC.</p>
</body>
</html>
The HTML version sees the comment as . . . a comment. Not visible to the end user.
The "caveat" is that if the mail client turns the HTML into entities, you have all this code at the bottom, hence the opening message for text only clients.
If you output html, make SURE it has an opening/closing html and body tag, just like a web page - otherwise SpamAssassin will add to your score: "HTML message, but no html tag . . . "
(AOL is JUST not getting emails at all..strange).
This is probably completely unrelated. Search around here for threads on email delivery, it could be DNS issues, no SPF records, you're hosted on a server that's in the RBL's, lots of things, most of them not related to PHP at all.
$body = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$body_text . "\n\n";
$body_html = "
<html>
<body>
<TABLE bgColor=white border=0 bgproperties=fixed borderColor=#000000 cellPadding=0 cellSpacing=0
width=640>
<tr><td>
your text
<p>
</td>
</tr>
</table>
</body>
</html>
\n\n";
$body .= "--{$mime_boundary}\n" .
"Content-Type: text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$body_html . "\n\n";
mail($email, 'subject', $body, $header );