TransWikia.com

Need Swift Mailer to send emails as UTF-8

Craft CMS Asked by Lily K on March 17, 2021

I have a Craft 3 site that used Freeform Pro for a contact form. All submissions from this form need to be sent, via email to a third party vendor who parses the information and submits it to a CRM. The format for the emails they receive is very specific: plain-text, utf-8 character set.

When I send a test email from the contact form, it appears to default to ascii if there isn’t a utf-8 character in the message. Is there a way to have SwiftMailer to send all emails as UTF-8?

One Answer

Completely untested, but try setting this in your public index.php file right before Craft executes:

Swift_Preferences::getInstance()->setCharset('UTF-8');

Based on https://swiftmailer.symfony.com/docs/messages.html#setting-the-character-set

Answered by Brad Bell on March 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP