PHPMailer character encoding issues

前端 未结 9 1061
太阳男子
太阳男子 2020-12-07 07:38

I try to use PHPMailer to send registration, activation. etc mail to users:

require(\"class.phpmailer.php\");
$mail -> charSet = \"UTF-8\";
$mail = new PH         


        
9条回答
  •  暖寄归人
    2020-12-07 08:02

    To avoid problems of character encoding in sending emails using the class PHPMailer we can configure it to send it with UTF-8 character encoding using the "CharSet" parameter, as we can see in the following Php code:

    $mail = new PHPMailer();
    $mail->From = 'midireccion@email.com';
    $mail->FromName = 'Mi nombre';
    $mail->AddAddress('emaildestino@email.com');
    $mail->Subject = 'Prueba';
    $mail->Body = '';
    $mail->IsHTML(true);
    
    
    // Active condition utf-8
    $mail->CharSet = 'UTF-8';
    
    
    // Send mail
    $mail->Send();
    

提交回复
热议问题