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

Popular posts from this blog

C# random value from dictionary and tuple -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -