I use phpmailer. I have included the program below. I send an email with a html table. I also include a text to show as alternative for programa that cannot read the html.
When I sent the email, the Outlook shows the content of the table but unformatted. Why does it not sent the text in altbody? I have tried Opera but there it always shows the table although I select plain text mode.
What I want is to send people an html email and if they cannot read it a link to a copy of the email on the internet.
Here the code:
When I sent the email, the Outlook shows the content of the table but unformatted. Why does it not sent the text in altbody? I have tried Opera but there it always shows the table although I select plain text mode.
What I want is to send people an html email and if they cannot read it a link to a copy of the email on the internet.
Here the code:
Code:
function MailNew($from,$to,$subject,$text,$htmltext)
{
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->IsSMTP();
$mail->From = $from;
$mail->FromName = $fromname;
$mail->AddAddress("email@address.it","");
$mail->AddReplyTo($from,$fromname);
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $htmltext;
$mail->AltBody = $text;
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
}
$table .= "<table border=1>";
$table .= "<tr>";
$table .= "<td>";
$table .= "Column 1";
$table .= "</td>";
$table .= "<td>";
$table .= "Column 2";
$table .= "</td>";
$table .= "</tr>";
$table .= "<tr>";
$table .= "<td>";
$table .= "Column 1";
$table .= "</td>";
$table .= "<td>";
$table .= "Column 2";
$table .= "</td>";
$table .= "</tr>";
$table .= "</table>";
MailNew("email@address.it","email@address.it","This is subject","This is plain tekst","This is the HTML message body <b>in bold!</b>$table");