PHP Mail header

别来无恙 提交于 2019-11-29 11:49:05
TFennis

Content-Type: text/html

If you set this header that means you have to send HTML to the user. You can either decide to use something like TinyMCE to let the user write the message in a Word-style editor and use the HTML output from that. Or set your headers to plaintext.

Content-Type: text/plain

EDIT: Try this

$to      = 'example@example.com';
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
$header = "From: noreply@example.com\r\n"; 
$header.= "MIME-Version: 1.0\r\n"; 
$header.= "Content-Type: text/plain; charset=utf-8\r\n"; 
$header.= "X-Priority: 1\r\n"; 

mail($to, $subject, $message, $header);
user3820294

I have used this header and this is worked for me...

$headers = '';
$headers = 'MIME-Version: 1.0'.PHP_EOL;
$headers .= 'Content-type: text/html; charset=iso-8859-1'.PHP_EOL;
$headers .= 'From: webmaster@example.com<From: webmaster@example.com>'.PHP_EOL; 

Don't use mail() function. Use a fully crafted class that does (correctly) the job for you.

http://code.google.com/a/apache-extras.org/p/phpmailer/

the problem with your code is because special characters need "special" charset too.

Try changing the charset=ISO to charset=UTF8...

Also, PHP mail() functions works ok, but you will find a lot more benefits and options if you go for a better solution like Swift Mailer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!