简体   繁体   中英

html email is not displaying in proper format in email (except gmail) when I send it using php mail function

I am new in php and trying to send email via php mail function. In gmail account email is displaying properly but other than gmail I received html tags as text in email body.

Here is my code snippet:

$headers  = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=ISO-8859-1' . "\r\n";

$headers .= "Reply-To:abc@abc.com" . "\r\n";

$headers .= "BCC: $bcc" . "\r\n";

$headers .= "From: $from" . "\r\n";

mail function which I am using is:

mail( $to, $subject, $body, $headers )

Got the solution, I just replaced '\\r\\n' with '\\n' and it started working perfectly for every mailbox.

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM