Sending email using Swift mailer in Yii2 sent wrong email contents

I am using Swift mailer to send email from my Yii2 based web applications. But it can’t read/receive in MS Outlook correctly.

Please see the email body bellow which I received using MS Outlook 2010 -


Content-Type: text/plain; charset=UTF-8

Content-Transfer-Encoding: quoted-printable

Dear Admin,=20

User john has been si= gned up



The App Tea=


This message was sent to If y= ou don't want

to receive future emails from ABC, please unsubs= cribe.


Content-Type: text/html; charset=UTF-8

Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.=


<html xmlns=3D"



<meta http-equiv=3D"Content-Type" con= tent=3D"text/html;

charset=3DUTF-8" />





	Dear Admin, <br>

<p>User John has been signed up successfully.</p>



<p>The ABC Team</p>

<br><br><br> =


<p style=3D'color: #B6B6B6'>

	This message was sent to = If you don't want to receive future emai= ls

from ABC, please <a href=3D'#'>unsubscribe</a>.

</p> =




I am using following configuration for encoding-

 'messageConfig' => [

 	'charset' => 'UTF-8', ],

And sending using-

Yii::$app->mailer->compose('mailview', ['name' => $name]) 

     		->setFrom([\Yii::$app->params['adminEmail'] => \Yii::$app->name . ' App'])




What am I missing?

Please provide info what transport service are you using for sending - PHP mail() function, SMTP server or IMAP?

Are you sending within your intranet or to some external server?

How is your network configured - does firewall allow outgoing requests on given port, are you using proxy etc…?

Mail body you provided is actually irrelevant information.

Tip: you can setup local mail server with either IIS server or hMailServer, if you need solid testing environment for emails.


I am using SMTP to send email from my Yii 2 based web application. I can receive and read email without any problem using other email services i.e Gmail, Yahoo but if I want to receive via IMAP (using MS Outlook 2010) then the email appear as unreadable.

I have added mail configuration code block below-

'mailer' => [

	'class' => 'yii\swiftmailer\Mailer',

	'viewPath' => '@common/mail',

	'useFileTransport' => false,

	'transport' => [

			'class' => 'Swift_SmtpTransport',

			'host' => 'localhost',

			'username' => '', // SMTP username

			'password' => '********',

			'port' => '25',



	'messageConfig' => [

		'charset' => 'UTF-8',