0
votes

I'm having trouble with Swiftmailer when i send a message and sometimes i receive that the content is completely broken (HTML stripped).

My software sends a lot of emails, and this thing happens almost every day but we can't get any log of it, since we are using Yii as our primary framework and it doesn't show any error (we use the log trace tool and the body is always HTML without any errors).

The worst thing is that we changed some of the code in Swiftmailer to break line before the default strip_tags used on the msgHTML() method to improve the plain/text part. So the real problem is that the users are not viewing the plain part but the HTML stripped, causing a lot of trouble.

Just an observation, we are using a relay to send through smtp (port 25 and no authentication).

Changes on Swiftmailer:

public function MsgHTML($body) {
    $this->body = $body;
    if ($this->altBody == null) {
        $this->altBody = str_replace('<br />', '<br />' . PHP_EOL, $this->body);
        $this->altBody = str_replace('</p>', '</p>' . PHP_EOL, $this->altBody);
        $this->altBody = strip_tags($this->altBody);
    }
    return $this;
}

HTML sent: Link

Please paste a copy of the raw email you are receiving including headers. Any code you modified to "improve" the swiftmailer library should also be posted here, please. You saying you have a problem is not enough to work with, we need to see the code you are using.skrilled
I edited the question adding code changed and the link to the raw htmlThiago Przyczynski
Thank you, can you just provide a raw email (one of the emails that's not displaying properly). Seeing how the boundary codes and actual raw email is delivered helps tremendously in discovering the problem.skrilled
That's the result from one of the "buggy" emails: Prezado(a), A demanda #0000 do chamado #00000 foi aberta. Clique aqui para acessá-la. Quantidade de Horas SLA: 00:00 Descrição: Ola, Gentileza verificar a tela abaixo, os boletos estão com data de vencimento retroativo, e antes não era assim, Ex : O boleto é gerado hoje , o vencimento sairá com data de hoje, porem o carregamento esta liberado ate o dia 01/01. Os clientes estão reclamando, que antes a data do vencimento e a data de retirada saiam o mesmo. Atenciosamente, Fulano de Ciclano - SACThiago Przyczynski