Answers.Body: <p>Craft 2 uses <a href="https://github.com/PHPMailer/PHPMailer" rel="nofollow noreferrer">PHPMailer</a> for its email sending library.</p>
  
  <p>It does have a public <a href="https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php#L47" rel="nofollow noreferrer">CharSet</a> property that Craft <a href="https://github.com/craftcms/cms/blob/develop-v2/src/services/EmailService.php#L286" rel="nofollow noreferrer">explicitly sets</a> to <code>UTF-8</code> when sending emails.</p>
  
  <p>The problem is, they have logic that overwrites our <code>UTF-8</code> value in certain circumstances... namely when no 8-bit characters are involved in the body setting it to <code>us-ascii</code>: <a href="https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php#L2453-L2458" rel="nofollow noreferrer">https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php#L2453-L2458</a></p>
  
  <p>Not sure of a good resolution as this seems like undesired behavior in the PHPMailer library to me.</p>
  
  <p>FWIW, the upcoming Craft 3 has ditched PHPMailer in favor of <a href="https://swiftmailer.symfony.com/" rel="nofollow noreferrer">Swift Mailer</a> where it is much more customizable.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-18T14:57:48.567Z
Answers.Text: Thank you, that's what we kind of figured after conducting a few tests, and hoping for a work around that would help our client until our Ducks are in a row for the update to Craft 3. For now we are hiding a an UTF-8 character in the form to trick the mailer into sending the form in the charset we want. Would just deleting that logic break everything?
Answers.UserDisplayName: Lily K
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-18T21:08:10.320Z
Answers.Text: Changing any of the core files would run the risk of them being overwritten in the future on an auto/manual update.  Not sure what other  runtime implication deleting that code might have.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-19T16:05:52.717Z
Answers.Text: Thank you Brad! In the end we added an random Ü to the end of the outgoing e-mail template that seemed to do the trick. Weird and hackey but I like to think of it as an extra happy smiley face for those hardworking customer service reps who have to read the submissions. Once we upgrade to Craft 3 we will look into more sophisticated options.  Your insight is very appreciated!
Answers.UserDisplayName: Lily K
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-17T17:33:02.743Z
Answers.LastActivityDate: 2018-04-17T17:33:02.743Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <blockquote>
    <p>does anyone know if you can send emails using utf-8 instead of ascii in CraftCMS 2?</p>
  </blockquote>
  
  <pre><code>$message = craft()-&gt;templates-&gt;render('path/to/file/', $someVariables);
  
  $email = new EmailModel();
  
  $email-&gt;fromEmail = $adminEmail;
  $email-&gt;replyTo = $adminEmail;
  $email-&gt;sender = $adminEmail;
  $email-&gt;fromName = craft()-&gt;getSiteName();
  $email-&gt;toEmail = $mail;    
  $email-&gt;subject = $subject;
  $email-&gt;htmlBody = $message;  // &lt;-- this is html and it will be send as utf8
  
  craft()-&gt;email-&gt;sendEmail($email);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-17T15:39:42.070Z
Answers.Text: Thank you but unfortunetly this won't work, i'm not writing a plug in. When Craft sends an e-mail it seems to either send it as a charset ASCII or UTF-8 based on the characters used.  If I add an ø  is sends the e-mail as UTF-8, if I don't it switches to ASCII. I'm trying to figure out how to change this to send the e-mail as UTF-8 as a default.
Answers.UserDisplayName: Lily K
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-17T06:42:43.630Z
Answers.LastActivityDate: 2018-04-17T06:42:43.630Z
Answers.UserDisplayName: Robin Schambach
Body: <p>does anyone know if you can send emails using utf-8 instead of ascii in CraftCMS 2?</p>
  
  <p>I am using the Freeform plugin to send entries from a "Contact Us" form to a CRM that needs to receive the e-mails in utf-8 but they are coming in as ASCII. Is there a way to change this in either the plugin or in Craft? </p>
  
  <p>Thank you!</p>
  
Tags: <emails><plugin-freeform>
Title: How to send e-mails using utf-8?
ThreadText: # How to send e-mails using utf-8?
  
  (Asked by: username_0 on 2018-04-16)
  
  does anyone know if you can send emails using utf-8 instead of ascii in CraftCMS 2?
  
  I am using the Freeform plugin to send entries from a "Contact Us" form to a CRM that needs to receive the e-mails in utf-8 but they are coming in as ASCII. Is there a way to change this in either the plugin or in Craft?
  
  Thank you!
  
  **Tags:** emails, plugin-freeform
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-04-17. Score: 1
  
  Craft 2 uses [PHPMailer](https://github.com/PHPMailer/PHPMailer) for its email sending library.
  
  It does have a public [CharSet](https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php#L47) property that Craft [explicitly sets](https://github.com/craftcms/cms/blob/develop-v2/src/services/EmailService.php#L286) to `UTF-8` when sending emails.
  
  The problem is, they have logic that overwrites our `UTF-8` value in certain circumstances... namely when no 8-bit characters are involved in the body setting it to `us-ascii`: <https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php#L2453-L2458>
  
  Not sure of a good resolution as this seems like undesired behavior in the PHPMailer library to me.
  
  FWIW, the upcoming Craft 3 has ditched PHPMailer in favor of [Swift Mailer](https://swiftmailer.symfony.com/) where it is much more customizable.
  
  > **Comments:**
  > **username_0**: Thank you, that's what we kind of figured after conducting a few tests, and hoping for a work around that would help our client until our Ducks are in a row for the update to Craft 3. For now we are hiding a an UTF-8 character in the form to trick the mailer into sending the form in the charset we want. Would just deleting that logic break everything?  
  > **username_1**: Changing any of the core files would run the risk of them being overwritten in the future on an auto/manual update.  Not sure what other  runtime implication deleting that code might have.  
  > **username_0**: Thank you username_1! In the end we added an random Ü to the end of the outgoing e-mail template that seemed to do the trick. Weird and hackey but I like to think of it as an extra happy smiley face for those hardworking customer service reps who have to read the submissions. Once we upgrade to Craft 3 we will look into more sophisticated options.  Your insight is very appreciated!  
  
  ---
  
  ### Answer by username_2 on 2018-04-17. Score: 0
  
  > does anyone know if you can send emails using utf-8 instead of ascii in CraftCMS 2?
  
  ```
  $message = craft()->templates->render('path/to/file/', $someVariables);
  
  $email = new EmailModel();
  
  $email->fromEmail = $adminEmail;
  $email->replyTo = $adminEmail;
  $email->sender = $adminEmail;
  $email->fromName = craft()->getSiteName();
  $email->toEmail = $mail;    
  $email->subject = $subject;
  $email->htmlBody = $message;  // <-- this is html and it will be send as utf8
  
  craft()->email->sendEmail($email);
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you but unfortunetly this won't work, i'm not writing a plug in. When Craft sends an e-mail it seems to either send it as a charset ASCII or UTF-8 based on the characters used.  If I add an ø  is sends the e-mail as UTF-8, if I don't it switches to ASCII. I'm trying to figure out how to change this to send the e-mail as UTF-8 as a default.  
  
  ---
  
  