> I am trying to set up a MIME email that would include an HTML and Plain
> Text version of content, such that if the recipient's email client did
> not understand html or have html disabled, that the content would come
> through as plain text, but if html were accepted, the plain text would
> be ignored so that it did not show as duplication.
> What I have currently works good for the html but the plain text shows
> up as well. The mail class is from PROFESSIONAL PHP PROGRAMMING.
> Snippet of code is:
> include("include/plain.inc"); // the plain text version --
> returns $body
> include("include/format.inc"); // html version -- returns
> $subject = "";
> $to = "[EMAIL PROTECTED]";
> $from = "adfarm";
> // create an instance
> $mail = new mime_mail;
> $mail->from = $from;
> $mail->to = $to;
> $mail->subject = $subject;
> $mail->body = "";
> $content_type="text/html; charset=us-ascii";
> $mail->add_attachment($data, "", $content_type);
> $mail->add_attachment($body, "", $content_type);
> echo("<h2>Newsletter has been sent.</h2>");
It is a good idea to have some content in text even though the main message is in HTML
- for those who have
text-only email clients! However not all clients handle the one-or-the-other scenario.
So your 'problem' may be
with the particular client, or may be with the MIME encoding.
Recommend a visit to http://ww.phpguru.org/ and adapt/upgrade to the MIME and SMTP
classes there (download
includes a set of examples - one sounds just like your construction). Have no
complaints with my
service/combined HTML and simple-text messages, built on these classes!
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php