Class EmailHelper
java.lang.Object
org.nuxeo.ecm.platform.ec.notification.email.EmailHelper
Helper class to build some
MailMessage
s from Map
s 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
computeSubject
(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 javax.mail.Session
newSession
(Properties props) Deprecated.protected String
renderHTMLBody
(Map<String, Object> mail, DocumentRenderingContext context) void
Deprecated.since 2023.4 because doesn't fit in a generic service.protected void
void
sendMailMessage
(Map<String, Object> mail) SendsMailMessage
s.
-
Constructor Details
-
EmailHelper
public EmailHelper()
-
-
Method Details
-
sendMailMessage
SendsMailMessage
s.- Since:
- 2023.4
-
sendmail
@Deprecated(since="2023.4") public void sendmail(Map<String, Object> mail) throws javax.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:
javax.mail.MessagingException
-
sendmail0
protected void sendmail0(Map<String, Object> mail) throws IOException, freemarker.template.TemplateException, RenderingException- Throws:
IOException
freemarker.template.TemplateException
RenderingException
-
computeSubject
protected String computeSubject(Map<String, Object> mail, DocumentRenderingContext context) throws IOException, freemarker.template.TemplateException, RenderingException- Throws:
IOException
freemarker.template.TemplateException
RenderingException
-
renderHTMLBody
protected String renderHTMLBody(Map<String, Object> mail, DocumentRenderingContext context) throws RenderingException- Throws:
RenderingException
-
newSession
Deprecated.since 11.1, useMailSessionBuilder
Instantiates 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