Exclamation Point Randomly In Result of PHP HTML-Email

email, html, php

Solution

As stated here: Exclamation Point in HTML Email

The issue is that your string is too long. Feed an HTML string longer than 78 characters to the mail function, and you will end up with a ! (bang) in your string.

This is due to line length limits in RFC2822 https://www.rfc-editor.org/rfc/rfc2822#section-2.1.1

Problem

I'm getting exclamation points in random spots in the result of this PHP email function. I read that it's because my lines are too long or I have to encode the email in Base64 but I do not know how to do that. This is what I have: ``` $to = "you@you.you"; $subject = "Pulling Hair Out"; $from = "me@me.me"; $headers = "From:" . $from; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= "Content-Transfer-Encoding: 64bit\r\n"; mail($to,$subject,$message,$headers); ``` How do I fix this so there's no random ! in the result? Thanks!

Original source

Related problems