html emails and plain text dectection
| From: | Ross | Date: | Mon, 16 Jul 2007 13:58:14 +0000 |
| Subject: | html emails and plain text dectection | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-258919@lists.php.net to get a copy of this message | ||
I am using the code to send an html email (phpmailer class) now I need to
somehow determine if the recipient uses text only email and change email to
plain. Is this possible?
include( 'html_emails/html2.php' );
$mail_body = ob_get_contents();
ob_end_clean();
include("../mailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->Mailer = "mail";
$mail->IsHTML(true);
$mail->Host = "imap.1and1.co.uk";
$mail->FromName = "Legal Services UK";
$mail->From = "xxxxx.";
$mail->Sender = "xxxxx>";
$mail->Subject = $_POST['mail_subject'];
$mail_to = $_POST['mail_to'];
$addresses = array();
$addresses = explode(",", $mail_to);
$mail->AddAttachment($userfile, $_FILES['userfile']['name']);
$mail->Subject = $_POST['mail_subject'];
$mail->Body =$mail_body;
$mail->WordWrap = 50;
for($i = 0; $i < count($addresses); $i++)
{
$mail->AddAddress($addresses[$i]);
if(!$mail->Send())
{
echo "Message was not sent";
echo "Mailer Error: " . $mail->ErrorInfo;
}
$mail->ClearAddresses();
?>
<script type="text/javascript">
<!--
alert('Your email was sent successfully');
window.location = "index.php"
//-->
</script>
<?php
}
}