• Hello,

    i have one plugin which sending notifications emails. Function for send mail is here:

    public static function sendEmail($email)
            {
                require_once(ABSPATH . WPINC . '/class-phpmailer.php');
                $mail = new PHPMailer ();
                $mail->AddAddress($email ["to"]);
                $mail->IsMail();
                $mail->IsHTML();
                $mail->From = $email ["from"];
                $mail->FromName = $email ["from_name"];
                $mail->Subject = $email ["subject"];
                $mail->Body = $email ["body"];
                $rst = $mail->Send();
                return $rst;
            }

    How i can add encoding utf8 to the this function?
    Is this correct?

    public static function sendEmail($email)
            {
                require_once(ABSPATH . WPINC . '/class-phpmailer.php');
                $mail = new PHPMailer ();
                $mail->AddAddress($email ["to"]);
                $mail->IsMail();
                $mail->IsHTML();
    
                $mail->setCharset = "UTF-8";
    
                $mail->From = $email ["from"];
                $mail->FromName = $email ["from_name"];
                $mail->Subject = $email ["subject"];
                $mail->Body = $email ["body"];
                $rst = $mail->Send();
                return $rst;
            }

    Thank you.

  • The topic ‘Add encoding utf8 to the function’ is closed to new replies.