I am using Gravity Forms
to handle forms and after the form submission I have coded a simple mail() function to send an email to the user. The headers work fine individually:
$headers = 'From: MyName
';
// or
$headers .= 'Content-type: text/html; charset=iso-8859-1
';
mail('me@gmail.com', 'My Subject', 'My Content', $headers);
but together in either order there is an issue"
$headers = 'From: MyName
'; // works fine
$headers .= 'Content-type: text/html; charset=iso-8859-1
'; // In this case the body is not rendered as HTML
// or
$headers = 'Content-type: text/html; charset=iso-8859-1
'; // renders as HTML
$headers .= 'From: MyName
'; // This now gives "unknown sender"
Any ideas?
Line breaks need to be double-quoted in order for " "
to be respected. As the headers are currently defined, ' '
is being treated as literal text, not a line break.
$headers = "From: MyName
";
$headers .= "Content-type: text/html; charset=iso-8859-1
";