email - PHP mail headers not working properly -
i trying create email in php, having problem constructing headers.
i from
admin@example.com, , other headers set show below.
the problem when send email, "from" part in email client appears as:
"admin@example.com rnreply-to: admin@example.com rnmime-version: 1.0 rncontent-type: text/html"
this inadvertently breaks rest of email because doesn't recognise being html.
// email headers $headers = 'from: admin@example.com \r\n'; $headers .= 'reply-to: admin@example.com \r\n'; $headers .= 'mime-version: 1.0 \r\n'; $headers .= 'content-type: text/html; charset=utf-8 \r\n';
any idea on how can fix these headers? thanks.
change following:
$headers = 'from: admin@example.com \r\n'; $headers .= 'reply-to: admin@example.com \r\n'; $headers .= 'mime-version: 1.0 \r\n'; $headers .= 'content-type: text/html; charset=utf-8 \r\n';
to this:
$headers = "from: admin@example.com \r\n"; $headers .= "reply-to: admin@example.com \r\n"; $headers .= "mime-version: 1.0 \r\n"; $headers .= "content-type: text/html; charset=utf-8 \r\n";
because \r\n
should in ""
(double quotes).
Comments
Post a Comment