PHPMailer Version 5.2.7
$mailerObject = new PHPMailer;
$mailerObject->CharSet = 'UTF-8';
$mailerObject->IsSMTP();
$mailerObject->Host = 'dsfdf.sdfsdf.com';
$mailerObject->SMTPAuth = TRUE;
$mailerObject->Username = 'dfgdfg';
$mailerObject->Password = 'dfgdfgdfg';
$mailerObject->SMTPSecure = 'tls';
$mailerObject->WordWrap = 60;
$mailerObject->From = '[email protected]';
$mailerObject->FromName = 'test.de';
$mailerObject->AltBody = $bodyTextTemp;
$mailerObject->MsgHTML($bodyHtmlTemp);
I am sending an HTML-Mail and an Text-Mail. In Thunderbird in HTML-Mode HTML is correctly shown. In Text-Mode you cant see the Text-Content ($bodyTextTemp), but the HTML-Content ($bodyHtmlTemp) where all HTML-Tags were removed (looks very ugly...).
Looking to the Mail-source, I can see that the AltBody wasnt send.
Why PHPMail dont accept my AltBody?
Because msgHTML overwrites AltBody. If you want to set Body and AltBody yourself, just set them. msgHTML is a convenience function to do several things for you, but you don't need to use it. If you want to use it but also set AltBody, just set it after you call msgHTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With