Php mail function not sending in html format

半城伤御伤魂 提交于 2019-12-06 03:31:18

this is most likely the problem: 'MIME-Version: 1.0\r\n' . '\r\n' .

after two endlines the headers end and the body starts. So your content-type declaration of text/html is being parsed as message body, while it belongs to headers.

remove one endline and it should work:

'MIME-Version: 1.0\r\n'

also I noticed you use single quotes for \r\n. You should use double quotes or else they will be escaped. You need them to be parsed.

 'From: me@gmail.com' . "\r\n" .
                'Reply-To: me@gmail.com' . "\r\n" .
                'X-Mailer: PHP/' . phpversion() . "\r\n" .
                'Content-Type: text/html; charset=ISO-8859-1'."\r\n".
                'MIME-Version: 1.0'."\r\n\r\n";
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!