AnsweredAssumed Answered

Create HTML email using MailAction

Question asked by analyzediz on Apr 30, 2010
Latest reply on Oct 22, 2014 by mrksjs
Hi all,

I'm currently using Alfresco's MailAction class to send emails based on a scheduled job definition. From my JavaScript I am able to  prepare the message by obtaining a reference to the mailAction object  and setting the desired parameters such as:

mail.parameters.to = "to address";
mail.parameters.subject = "subject";
mail.parameters.from = "from address";

I was able to successfully but If I attempt to send an HTML snippet, it's sending the email body as if it's a plain text email. I see that the underlying MailActionExecuter class uses the MimeMessageHelper to prepare the email that is to be sent. Of note is the setText() call on the MimeMessageHelper which sets the email body. It seems like the MailActionExecuter uses the setText(text) variant of this method and provides no way of invoking the setText(text, boolean) version which would allow one to specify a boolean value indicating that the body text is HTML.

Is there a way of getting around this, short of having to extend the MailActionExecuter? It seems like it would end up being a lot of duplicated code just to get this working.

Am I missing something here? Any pointer would be greatly appreciated.

Thanks.

Outcomes