Code
<?php
mb_internal_encoding('UTF-8');
$to_email = "zwb@bin.com";
$subject = mb_encode_mimeheader('邮件主题','UTF-8');
$header = "MIME-Version: 1.0\r\n";
$header .="From: apache@mail.com\r\n";
$header .= "Content-type: text/html; charset=UTF-8\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
$body = "<html><head>头部</head><body>身体</body></html>";
if(mail($to_email,$subject,chunk_split(base64_encode($body)),$header)){
echo 'succ';
}else{
echo 'fail';
}
?>
邮件内容太长的时候会有问题 加上chunk_split
简单的发送html格式邮件的功能,环境为centos5、postfix