public class MailServiceImpl extends MailService implements org.apache.camel.CamelContextAware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
| Modifier and Type | Class and Description |
|---|---|
static class |
MailServiceImpl.MailSettingsChangedEvent
This event is fired when the changes in mail server connection settings are detected (notification from other cluster nodes).
|
settingsBean| Constructor and Description |
|---|
MailServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
String |
defaultRecipient() |
String |
defaultSender() |
void |
destroy() |
org.apache.camel.CamelContext |
getCamelContext() |
String |
getEndpointUri() |
MailSettings |
getSettings()
Returns the settings.
|
void |
handleSend(org.apache.camel.Exchange exchange) |
protected void |
load() |
void |
onApplicationEvent(org.springframework.context.ApplicationEvent evt) |
boolean |
sendHtmlMessage(String from,
String to,
String cc,
String bcc,
String subject,
String message)
Send message in the HTML format to the desired destination with cc and bcc option.
|
void |
sendMessage(MailMessage message)
Send provided mail message.
|
boolean |
sendMessage(String message)
Send message to the default Jahia settings defined in the jahia.properties
file.
|
void |
sendMessage(String endpointUri,
MailMessage message)
Sends the provided mail message to the specified endpoint.
|
boolean |
sendMessage(String to,
String message)
Send message to the desired destination.
|
boolean |
sendMessage(String from,
String to,
String message)
Send message to the desired destination.
|
boolean |
sendMessage(String from,
String to,
String cc,
String bcc,
String subject,
String message)
Send message to the desired destination with cc and bcc option.
|
void |
sendMessage(String from,
String toList,
String ccList,
String bcclist,
String subject,
String textBody,
String htmlBody)
Send message to the desired destination with cc and bcc option.
|
void |
sendMessage(String endpointUri,
String from,
String toList,
String ccList,
String bcclist,
String subject,
String textBody,
String htmlBody) |
void |
sendMessageWithTemplate(MailMessage message,
String template,
Map<String,Object> boundObjects,
Locale locale,
String templatePackageName)
Send provided mail message using specified template that is responsible for producing mail subject and body.
|
void |
sendMessageWithTemplate(String template,
Map<String,Object> boundObjects,
String toMail,
String fromMail,
String ccList,
String bcclist,
Locale locale,
String templatePackageName) |
void |
setCamelContext(org.apache.camel.CamelContext camelContext) |
void |
setCharset(String charset) |
void |
setMailEndpointUri(String mailEndpointUri)
Sets the URI of the default mail sending endpoint.
|
void |
setScriptEngineUtils(ScriptEngineUtils scriptEngineUtils) |
void |
setTemplateCharset(String templateCharset) |
void |
setTemplateManagerService(JahiaTemplateManagerService templateManagerService) |
void |
start() |
void |
stop() |
void |
store(MailSettings cfg)
Persists the changes in mail server connection configuration.
|
protected void |
store(MailSettings cfg,
JCRSessionWrapper session) |
static MailSettingsValidationResult |
validateSettings(MailSettings cfg,
boolean skipIfEmpty)
Validates entered values for mail settings.
|
getInstance, isEnabled, isValidEmailAddress, sendMessagegetSettingsBean, setSettingsBeanpublic static MailSettingsValidationResult validateSettings(MailSettings cfg, boolean skipIfEmpty)
cfg - the mail settings, entered by userskipIfEmpty - skips the validation and returns successful result if
all values are emptypublic String defaultRecipient()
defaultRecipient in class MailServicepublic String defaultSender()
defaultSender in class MailServicepublic org.apache.camel.CamelContext getCamelContext()
getCamelContext in interface org.apache.camel.CamelContextAwarepublic MailSettings getSettings()
getSettings in class MailService@Handler public void handleSend(org.apache.camel.Exchange exchange)
public String getEndpointUri()
public boolean sendHtmlMessage(String from, String to, String cc, String bcc, String subject, String message)
MailServicesendHtmlMessage in class MailServicefrom - The message senderto - The message destination.cc - The message copy destination.bcc - The message copy blind destination.subject - The message subject.message - The message to send.public boolean sendMessage(String message)
MailServicesendMessage in class MailServicemessage - The message to sendpublic boolean sendMessage(String to, String message)
MailServicesendMessage in class MailServiceto - The message destination.message - The message to send.public boolean sendMessage(String from, String to, String message)
MailServicesendMessage in class MailServicefrom - The message senderto - The message destination.message - The message to send.public boolean sendMessage(String from, String to, String cc, String bcc, String subject, String message)
MailServicesendMessage in class MailServicefrom - The message senderto - The message destination.cc - The message copy destination.bcc - The message copy blind destination.subject - The message subject.message - The message to send.public void sendMessage(String from, String toList, String ccList, String bcclist, String subject, String textBody, String htmlBody)
MailServicesendMessage in class MailServicefrom - The message sendertoList - The message destination.ccList - The message copy destination.bcclist - The message copy blind destination.subject - The message subject.textBody - The text message to sendhtmlBody - The HTML message to sendpublic void sendMessage(String endpointUri, String from, String toList, String ccList, String bcclist, String subject, String textBody, String htmlBody)
public void sendMessage(MailMessage message)
MailServicesendMessage in class MailServicemessage - the mail message to be sentpublic void sendMessage(String endpointUri, MailMessage message)
endpointUri - the target endpoint URL to send the messagemessage - the mail message to be sentpublic void setCamelContext(org.apache.camel.CamelContext camelContext)
setCamelContext in interface org.apache.camel.CamelContextAwarepublic void setMailEndpointUri(String mailEndpointUri)
mailEndpointUri - the URI of the default mail sending endpointpublic void start()
start in class JahiaServicepublic void stop()
stop in class JahiaServicepublic void sendMessageWithTemplate(String template, Map<String,Object> boundObjects, String toMail, String fromMail, String ccList, String bcclist, Locale locale, String templatePackageName) throws javax.jcr.RepositoryException, ScriptException
sendMessageWithTemplate in class MailServicejavax.jcr.RepositoryExceptionScriptExceptionpublic void sendMessageWithTemplate(MailMessage message, String template, Map<String,Object> boundObjects, Locale locale, String templatePackageName) throws ScriptException
MailServicesendMessageWithTemplate in class MailServicemessage - the mail message to be senttemplate - the template script pathboundObjects - the objects for the script enginelocale - the locale to find the appropriate template scripttemplatePackageName - the module ID to lookup i18n resources fromScriptException - in case of an error executing template scriptpublic void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanExceptionpublic void setScriptEngineUtils(ScriptEngineUtils scriptEngineUtils)
protected void load()
public void store(MailSettings cfg)
MailServicestore in class MailServicecfg - the new mail settings to be storedprotected void store(MailSettings cfg, JCRSessionWrapper session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void onApplicationEvent(org.springframework.context.ApplicationEvent evt)
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic void setCharset(String charset)
public void setTemplateManagerService(JahiaTemplateManagerService templateManagerService)
public void setTemplateCharset(String templateCharset)
Copyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.