EMail enconding Hybris

I'm trying to send an email using the sendEmail action. Everything goes well excepts for the email encoding. I need it to be UTF-8 but I can't find how set it up.

Upvotes: 0

Views: 683

Answers (1)

Johannes von Zmuda
Johannes von Zmuda

Reputation: 1822

The default encoding should be UTF-8. Have a look at

de.hybris.platform.acceleratorservices.email.impl.DefaultEmailService

in the method

public boolean send(final EmailMessageModel message)

and:

protected String getBody(final EmailMessageModel message)

The only reason I would see, is that UTF-8 is not supported by your system. But that doesn't sound very likely.

Maybe you imported the template in the wrong encoding? The template for email subject and body is an attribute of the EmailPageTemplate. Look it up in hmc/backoffice in WCMS/Page templates. Restrict the search to Email Page Templates. Find your Template. The tab Administration holds the related templates. The attributes are called Html Email Template and Email Subject. Right click them and select edit (in new window) to view the content.

You can look up your templates for cms components in your email page in hmc/backoffice in system/output documents/communication templates.

The default code for a component is:

<siteUid>-<Component Typecode>-template

e.g.

mysite-CMSParagraphComponent-template

If the content is not correct, change it in hmc/backoffice or reimport it. An impex file would look like this:

$emailResource=jar:de.hybris.mystore.core.setup.CoreSystemSetup&/mystorecore/import/emails
$lang=en

UPDATE RendererTemplate;code[unique=true];description[lang=$lang];templateScript[lang=$lang,translator=de.hybris.platform.commerceservices.impex.impl.FileLoaderValueTranslator]
# Import MyCmsComponent for mystore
;mystore-MyCmsComponent-template;"MyCmsComponent Template";$emailResource/email-myCmsComponentTemplate.vm
# Import MyEmail Content
;mystore_My_Email_Body;"My Email Body";$emailResource/email-myEmailBody.vm
;mystore_My_Email_Subject;"My Email Subject";$emailResource/email-myEmailSubject.vm

Now make sure, that the files email-myCmsComponentTemplate.vm, email-myEmailBody.vm and email-myEmailSubject.vm in the directory mystorecore/import/emails are UTF-8 encoded.

Upvotes: 1

Related Questions