php-swiftmailerHow to send emails in UTF8 using Swiftmailer?
Swiftmailer supports sending emails in UTF8. To do this, you need to set the charset of the message to UTF8. This can be done by using the setCharset()
method of the Swift_Message
class.
$message = new Swift_Message();
$message->setCharset('UTF-8');
The code above will set the charset of the message to UTF8.
Code explanation
$message
: This is an instance of theSwift_Message
class.setCharset()
: This is a method of theSwift_Message
class which sets the charset of the message.'UTF-8'
: This is the charset which is being set for the message.
Helpful links
More of Php Swiftmailer
- How to log emails sent with Swiftmailer?
- How to use TLS 1.2 with Swiftmailer?
- How to enable TLS with Swiftmailer?
- How to use SMTP with Swiftmailer?
- How to set timeout with Swiftmailer?
- How to get the response code when using Swiftmailer?
- How to set the sender name in SwiftMailer?
- How to set the 'from' address in Swiftmailer?
- How to use Swiftmailer with SendGrid?
- How to encrypt emails with SwiftMailer?
See more codes...