3

I have an issue with transactional emails with special characters (é, è, à, etc.)

For the "Official Emails" such as "order_new.html" which are sent by magento core, everything works fine and all the special characters are well displayed in the mailbox.

But for custom transactional emails I define in Backend and send using custom modules special characters are not displayed correctly

ex : été vérifiés avec succès

I tried defining utf-8 encoding both in email template and in the module code with setHeader(), but I have the same result.

Here is my code :

$mail = Mage::getModel('core/email') ->setToName($ToName) ->setToEmail($ToEmail) ->setHeader('Content-type', 'text/xml; charset=UTF-8') ->setBody($processedTemplate) ->setSubject('tototototo') ->setFromEmail($senderEmail) ->setFromName($senderName) ->setType('html'); 
2
  • Did you fix it ? :) Facing the same issue Commented Feb 20, 2018 at 9:09
  • see below. I use zend mail Commented Feb 20, 2018 at 13:47

2 Answers 2

5

I managed to find a solution by using Zend Mail :

$mail = new Zend_Mail('UTF-8'); $mail->setType(Zend_Mime::MULTIPART_RELATED); $mail->setBodyHtml($processedTemplate); $mail->setFrom($senderEmail, $senderName); $mail->addTo($ToEmail, $ToName); $mail->setSubject('I love UTF8'); 

If it can help...

1

If you're using Ashroder_SMTPPro module, and you use the @Alexglvr's approach above, you'll always be sending emails using sendmail (instead the configured method on SMTPPro).

If you want to use your configured SMTP Settings in Ashroder's module, you may want to do something like:

$transport = null; //if Aschroder is enabled, we try to get the transport configured in the admin. Otherwise, it will use default sendmail. if(Mage::helper('core')->isModuleEnabled('Aschroder_SMTPPro')){ $helper = Mage::helper('smtppro'); $transport = $helper->getTransport(); } //Confimation E-Mail Send $mail->send($transport); 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.