D
D
Dim Boy2015-12-06 17:06:21
PHPMailer
Dim Boy, 2015-12-06 17:06:21

Why is the encoding of some letters in the letter incorrect?

Sending PhpMailer emails, example code:

$message = "mailtext";

          if(phpnum()>=5)
            require("class.phpmailer5.php");
          else
            require("class.phpmailer4.php");

          $mail = new PHPMailer();
          $mail->From = $main_smarty->get_config_vars('Email_From');
          $mail->FromName = $main_smarty->get_config_vars(Email_Name');
          $mail->AddAddress($this->email);
          $mail->AddReplyTo($main_smarty->get_config_vars('Email_From'));
          $mail->IsHTML(true);
          $mail->Subject = $main_smarty->get_config_vars('Email_Subject_verification');
          $mail->CharSet = 'utf-8';
          $mail->MsgHTML( $message );
        
          
          if(!$mail->Send())

in the letter I get 2-3 letters: Ñ �or іÐ �and sometimes spaces appear in the link, for example, I http: //ww.site.com
tried to add in turn:
$message = iconv("UTF-8", "WINDOWS-1251", $message);
$message = mb_convert_encoding("UTF-8", "WINDOWS-1251", $message);
$message = mb_detect_encoding($message , mb_detect_order(), true) === 'UTF-8' ? $message : mb_convert_encoding($message , 'UTF-8');

does not help, but maybe they need to be configured? (iconv, mb_convert)
if so, how? - I have ubuntu 14.04
iconv
mbstring

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question