听老歌 发表于 2011-06-11 14:57

PHP发送邮件,解决乱码

PHP发送邮件,解决乱码<?php

   $to = "429517385@qq.com";   

      $date = date("Y年m月d日");   

   $header= 'MIME-Version: 1.0' . "\r\n";   

$header .= 'Content-type: text/html; charset=utf-8' . "\r\n";

   $header .= "To: $to \r\n";    $header .= 'From: 624159864@qq.com' . "\r\n";   

    $mailsubject= "=?UTF-8?B?".base64_encode($mailsubject)."?=";

$mailsubject= "绿尔雅减肥茶订单";

$user = $_POST['name'];

$qq = $_POST['email'];

$shouji = $_POST['shouji'];

$number = $_POST['number'];

$address = $_POST['address'];

$contents = $_POST['content'];   

$content = '客户'."$user".'<br />';   

$content .= '<br />';   

$content .= '订购了'."$number!".'<br />';   

$content .= '联系电话:'."$shouji".'<br />';

$content .= '联系QQ:'."$qq".'<br />';

$content .= '收货地址:'."$address".'<br />';

$content .= '客户留言:'."$contents".'<br />';   

    $content .= "$date".'<br />';

ini_set("mbstring.language", "Neutral");

ini_set("mbstring.internal_encoding", "UTF-8");

ini_set("mbstring.http_input", "UTF-8");

ini_set("mbstring.http_output", "UTF-8");

ini_set("mbstring.encoding_translation", "On");

ini_set("mbstring.detect_order", "auto");

ini_set("mbstring.substitute_character", "long");   

$result = mail($to, $mailsubject, $content, $headers);      

if($result)    {      echo '订购成功!';    }

?>

辣椒封 发表于 2011-06-11 23:06

火速围观!牛人招PHP技术员-出得厅堂,下得厨房,进得洞房!有木有!!有木有!!

http://bbs.phpchina.com/thread-214382-1-1.html   这公司太有才了,做PHP的还要求会武功,找金庸大师学学吧,笑死俺了哈

亮图标 发表于 2011-06-12 16:24

火速围观!牛人招PHP技术员-出得厅堂,下得厨房,进得洞房!有木有!!有木有!!

http://bbs.phpchina.com/thread-214382-1-1.html   这公司太有才了,做PHP的还要求会武功,找金庸大师学学吧,笑死俺了哈

yangyang1581 发表于 2011-06-12 21:22

private function alarmMail($table,$title)
      {
                $subject = stripslashes($title);
                $subject = "=?UTF-8?B?".base64_encode($subject)."?=";
                $message = "<html><head><title>{$title}</title></head><body>$table</body></html>";
                $from = '';
                $to = '';
                $headers= 'MIME-Version: 1.0'.PHP_EOL;
                $headers .= "Content-type: text/html; charset=utf-8".PHP_EOL;
                $headers .= "From: $from";
                mail($to,$subject,$message,$headers);
      }
页: [1]
查看完整版本: PHP发送邮件,解决乱码