很怀疑楼上的是不是都是抄的。
以下是我帮别人写的一段发送找回密码的代码,在windows,apache2,php5下正常运行,也没有乱码现象
需要windows的STMP支持,
STMP可以在控制面板的 添加/删除软件 里面安装
$to = $info['txtEmail'];
$subject = "找回密码";
$subject = "=?UTF-8?B?".base64_encode('找回密码')."?=";
$message = $txtUnionID.',你好:
请点击下面链接找回密码:
<a href="http://'.$_SERVER['SERVER_NAME']" target="_blank">
http://'.$_SERVER['SERVER_NAME'].'/union/index.php?m=forgetPassword&id='.$md5.'</a>
(如果链接无法点击,
请将它拷贝到浏览器的地址栏中。)
有效时间为三天
此邮件为系统自动发送,请勿回复'.
$_SERVER['SERVER_NAME'].
date('Y年m月d日');
$from = "
[email protected]";
//$headers = "From: $from";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= "From: $from"."\r\n"."Reply-to:$from"."\r\n"."X-Mailer: PHP".phpversion()."\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
mail($to,$subject,$message,$headers);