您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

phpMailer 中文乱码有关问题

2024/6/12 15:45:18发布13次查看
phpmailer 中文乱码问题
本人用phpmailer 类库想发一封电子邮件,编码已经设置成了utf-8,但如果发件人,收件人,及主题中包含中文字符,则显示乱码问题,很是不爽。从网上找了一些方法,他们是修改 class.phpmailer.php 文件。由于我不想修改它,想求高人指点。。谢谢了先。
------解决方案--------------------
c/c++ code我试验了一下,成功了,代码网上直接摘过来填了填,标题及内容都不乱码。楼主的php文件是windows的还是linux的? 注意php文件自身编码与mailer设置的编码一致,我下的最新的phpmailer,163发往qq,成功。charset =utf-8;//设定邮件编码,默认iso-8859-1,如果发中文此项必须设置,否则乱码 $mail->issmtp(); // 设定使用smtp服务 $mail->smtpdebug = 1; // 启用smtp调试功能 // 1 = errors and messages // 2 = messages only $mail->smtpauth = true; // 启用 smtp 验证功能 $mail->host = smtp.163.com; // smtp 服务器 $mail->port = 25;// smtp服务器的端口号 $mail->username = abcdii; // smtp服务器用户名 $mail->password = xxxx; // smtp服务器密码 $mail->setfrom('abcdii@163.com', 'liangdong'); $mail->addreplyto(abcdii@163.com,liangdong); $mail->subject = $subject; $mail->altbody = to view the message, please use an html compatible email viewer! - from www.jiucool.com; // optional, comment out and test $mail->msghtml($body); $address = $to; $mail->addaddress($address, liangdong); //$mail->addattachment(images/phpmailer.gif); // attachment //$mail->addattachment(images/phpmailer_mini.gif); // attachment if(!$mail->send()) { echo mailer error: . $mail->errorinfo; } else { echo message sent!恭喜,邮件发送成功!; } }postmail_jiucool_com('120848369@qq.com', '我是梁栋', '你好');?>

该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product