[ACCEPTED]-Sending Plain text emails using PHPMailer-plaintext
Accepted answer
You are setting $mail->MsgHTML()
to a plain text message, and 4 since whitespace formatting is ignored in 3 HTML, you're getting an inline text.
I haven't 2 used PHPMailer for a while, but from memory 1 try:
$mail->Body = file_get_contents($newFile);
$mail->ContentType = 'text/plain';
$mail->IsHTML(false);
$address = "test@test.com";
$mail->AddAddress($address, "John Doe");
$mail->SetFrom(EMAIL_TEST_FROM);
$mail->AddReplyTo(EMAIL_TEST_REPLY);
$mail->Subject = $action." REGISTRATION ".$formName.$tld;
$mail->From = EMAIL_TEST;
// Very important: don't have lines for MsgHTML and AltBody
$mail->Body = file_get_contents($mailBodyTextFile);
// $mail->Body = $_POST["msg"]; //If using web mail form, use this line instead.
if($mail->Send()){
return true;
}
0
Try below code which works fine:
try {
$mail->AddAddress('jitpal@domain.com', 'Jit Pal');
$mail->SetFrom('testuser@domain.com', 'Test User');
$mail->Subject = "All machine's tests.";
$mail->Body = "All machine's tests working fine.";
$mail->Send();
echo "<br/>Message sent successfully...<br/><br/>\n";
} catch (phpmailerException $e) {
echo $e->errorMessage();
} catch (Exception $e) {
echo $e->getMessage();
}
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.