Class EmailHelper
java.lang.Object
org.nuxeo.ecm.platform.ec.notification.email.EmailHelper
Helper class to build some
MailMessages from Maps and send them through the MailService.
Hashtable mail = new Hashtable();
mail.put("from", "[email protected]");
mail.put("to", "[email protected]");
mail.put("subject", "a subject");
mail.put("template", "a template name");
<p>
EmailHelper.sendMailMessage(mail);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcomputeSubject(Map<String, Object> mail, DocumentRenderingContext context) evaluateMvelExpresssion(String expr, Map<String, Serializable> ctx) Evaluates a MVEL expression within some context infos accessible on the "NotificationContext" object.initMvelBindings(Map<String, Serializable> infos) static jakarta.mail.SessionnewSession(Properties props) Deprecated.protected StringrenderTemplate(String template, DocumentRenderingContext context) voidDeprecated.since 2023.4 because doesn't fit in a generic service.protected voidvoidsendMailMessage(Map<String, Object> mail) SendsMailMessages.
-
Constructor Details
-
EmailHelper
public EmailHelper()
-
-
Method Details
-
sendMailMessage
SendsMailMessages.- Since:
- 2023.4
-
sendmail
@Deprecated(since="2023.4") public void sendmail(Map<String, Object> mail) throws jakarta.mail.MessagingExceptionDeprecated.since 2023.4 because doesn't fit in a generic service. UsesendMailMessage(java.util.Map<java.lang.String, java.lang.Object>)instead.Sends mails from aMap.- Parameters:
mail- A map of the settings- Throws:
jakarta.mail.MessagingException
-
sendmail0
protected void sendmail0(Map<String, Object> mail) throws IOException, freemarker.template.TemplateException, RenderingException- Throws:
IOExceptionfreemarker.template.TemplateExceptionRenderingException
-
computeSubject
protected String computeSubject(Map<String, Object> mail, DocumentRenderingContext context) throws IOException, freemarker.template.TemplateException, RenderingException- Throws:
IOExceptionfreemarker.template.TemplateExceptionRenderingException
-
renderTemplate
protected String renderTemplate(String template, DocumentRenderingContext context) throws RenderingException - Throws:
RenderingException
-
newSession
Deprecated.since 11.1, useMailSessionBuilderInstantiates a new session that authenticates given the protocol's properties. Initializes also the default transport protocol handler according to the properties.- Since:
- 5.6
-
initMvelBindings
-
evaluateMvelExpresssion
Evaluates a MVEL expression within some context infos accessible on the "NotificationContext" object. Returns null if the result is not evaluated to a String- Since:
- 5.6
-
MailSessionBuilder