zoukankan      html  css  js  c++  java
  • 用phpmailer发邮件 中文乱码问题解决

    加入如下代码解决。

    $mail->CharSet = "GB2312"; //utf-8;
    $mail->Encoding = "base64";
    <?php
    set_time_limit(0);
    
    include("class.phpmailer.php");
    include("class.smtp.php");
    
    $mail=new PHPMailer();
    
    function send_email($mail,$reply_to,$to,$receive_name,$subject,$content)
    {
     $mail->IsSMTP();
     $mail->CharSet = "GB2312";                     //utf-8;
     $mail->Encoding = "base64";
     $mail->SMTPAuth   = true;
     $mail->SMTPSecure = "ssl";
     $mail->Host       = " smtp ";                  // set smtp server domain or ip;
     $mail->Port       = 465; 
     $mail->Username   = " login account ";        // login account;
     $mail->Password   = " login password ";       // login password
     $mail->From       = " login account ";        // login account;
     $mail->FromName   = "sender name";            // sender name;
     $mail->Subject    = "$subject";
     $mail->Body       = "$content";
     $mail->AltBody    = "$content";
     $mail->WordWrap   = 50000;
     $mail->AddAddress($to,$receive_name);
     $mail->AddReplyTo("$reply_to","");             // reply to whom;
     $mail->AddAttachment("/path/to/file.zip");
     $mail->AddAttachment("/path/to/image.jpg", "new.jpg");
     $mail->IsHTML(true);
     
     if(!$mail->Send())
     {
      $send_result=$mail->ErrorInfo;  
     }
     else
     {
      $time=time();
      $time=date("Y-m-d H:i:s A");
      $send_result="Email sent to $to, at $time, Success";  
     } 
     return($send_result);
    }
    
     
    
    /*
    the following code is a simple;
    */
    $reply_to='sender@domain.com';
    $to='customer@domain.com';
    $receive_name='Carson';
    $subject='xd function test last one';
    $content='<h1><font color=#f00>xd function test<br>last one</font></h1>';
    
    $send_email=send_email($mail,$reply_to,$to,$receive_name,$subject,$content);
    echo $send_email;
    ?>
    View Code
  • 相关阅读:
    iOS 方便的宏定义
    IOS 推送消息 php做推送服务端
    iOS 7 动画UIDynamicAnimator
    iOS 适配
    ios 实现简单的解析xml网页
    用 MPMoviePlayerController 实现简单的视频下载播放功能
    ios 自定义弹出对话框效果
    ios国外大神
    git学习
    ios 7UI适配方法
  • 原文地址:https://www.cnblogs.com/cssfirefly/p/4517590.html
Copyright © 2011-2022 走看看