Title: Add encoding utf8 to the function
Last modified: August 31, 2016

---

# Add encoding utf8 to the function

 *  [grezom](https://wordpress.org/support/users/grezom/)
 * (@grezom)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/add-encoding-utf8-to-the-function/)
 * 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.

## Tags

 * [encode](https://wordpress.org/support/topic-tag/encode/)
 * [function](https://wordpress.org/support/topic-tag/function/)
 * [mail](https://wordpress.org/support/topic-tag/mail/)
 * [utf8](https://wordpress.org/support/topic-tag/utf8/)

 * 0 replies
 * 1 participant
 * Last reply from: [grezom](https://wordpress.org/support/users/grezom/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/add-encoding-utf8-to-the-function/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
