I am currently having a problem with received emails that were sent from PHPMailer using plain / text messages. I am currently returning an email from the database, retrieving the string and storing $ message in the variable. A message in the database is formatted as such:
This is some email information. \r\n This is some more email information.
The received message shows the message with \ r \ n, and does not return a new line.
My PHPMailer code looks something like this:
$subject = $row['subject'];
$message = $row['message'];
$mail = new PHPMailer();
$mail->From = "noreply@mywebsite.org";
$mail->FromName = "MyWebsite.org";
$mail->AddAddress('recipient@email.com');
$mail->ContentType = 'text/plain';
$mail->IsHTML(false);
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AltBody = $message;
if(!$email->Send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}
My question is . How can I format the format correctly using PHPMailer? Is this a PHPMailer parameter, or am I doing something wrong in my code?
source
share