Swiftmailer - Corrupted HTML on receipt


I'm having problems with Swiftmailer when I send a message and sometimes I get complaints that the content is completely broken (HTML removed).

My software sends a lot of emails, and this problem happens almost every day, but we can not get any log that has the reason. Since we are using Yii as our main framework and we use the log (and trace) tracking tool that presents the email correctly we can not succeed in the reason for the problem.

To improve we've changed part of the Swiftmailer code to perform the line break before the strip_tags used by default in the msgHTML () method, the problem is that users are not seeing the text / plain part of the email, but HTML treated by the client (without any tags and all together).

Just a note, we are using relay to send through SMTP from Outlook Exchange (port 25 and without authentication). We talked to the Microsoft support staff and they reported that this problem should be in our tool.

asked by anonymous 15.09.2014 / 20:39

1 answer


Without seeing your code it's kind of hard, but I had a similar problem.

I was using this way:

$html = $this->renderPartial('view',array(),true);

It has been resolved by changing renderPartial() to render() with some settings:

$this->layout = 'layout-email';
$html = $this->render('view',array(),true);
$this->layout = 'layout-da-pagina';
17.09.2014 / 20:11