Overlength date field error in prestashop
Recently I got this error when trying to send emails in prestashop.
An email was bouncing back and it contained the following message:
This message has been rejected because it has
an overlength date field which can be used
to subvert Microsoft mail programs
After a lot of headaches and a cofee 🙂 I manage to detect what was wrong:
Presta uses in the email class a variable $templateVars
this was like:
$templateVars = array(
‘{date_facturare}’ =>
‘Nume Firma: ‘.$invoice->company.'<br>’.
‘Cod fiscal: ‘.$invoice->tax_code.'<br>’.
‘Registrul Comertului: ‘.$invoice->reg_data.'<br>’.
‘IBAN: ‘.$customer->iban.'<br>’,
‘CNP: ‘.$invoice->cnp.'<br>’,
‘{firstname}’ => $customer->firstname,
‘{lastname}’ => $customer->lastname, …
However the problem was because of a , instead of .
'IBAN: '.$customer->iban.'<br>',
should have been:
'IBAN: '.$customer->iban.'<br>'.
Because of the wrong “,”, $templateVars[0] was taking a long value and apparently Swift Mailer was appending it to the header date of the email hence the error with the overlength date field.