I have switched to using an HTML template when sending email using PHPmailer. After doing so I receive a message within GMAIL stating [Message clipped] View entire message
In troubleshooting I have tried deleting the contents of the HTML template file so that it is blank, but still receive the clipped message. However, if I copy the HTML template code directly in to $mail->MsgHTML('');
and don't use file_get_contents
I do not receive that the message was clipped. This leads me to believe something within the file_get_contents
is causing the issue?
I should add that there isn't anything actually being clipped from the email when the message is displayed.
$message = file_get_contents('path_to_HTML_template');
$mail->MsgHTML($message);
$mail->send();
UPDATE
Apparently I needed to convert the template to HTML-ENTITIES before sending:
$message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
UPDATE 2
And the reason I was having to use mb_convert_encoding
was due to a BOM (byte order mark) in my HTML template file. After removing this I no longer have to convert the template.