Class MailService
java.lang.Object
fr.paris.lutece.portal.service.mail.MailService
Application Mail Service
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns a no reply email address defined in config.propertiesstatic IMailQueuegetQueue()Returns the mail queuestatic StringgetSiteLink(String strBaseUrl, boolean linkToFrontOffice) Get a string that contains an html link to the site back office or front office.static StringgetStrRecipients(List<String> listRecipients) Return a String that contains a list of recipients separated with mail separatorstatic List<UrlAttachment>getUrlAttachmentList(String strHtml, String strBaseUrl, boolean useAbsoluteUrl) Extract a collection of elements to be attached to a mail from an HTML string.static voidsendMailCalendar(String strRecipientsTo, String strSenderName, String strSenderEmail, String strSubject, String strMessage, String strCalendarMessage, boolean bCreateEvent) Send a calendar message asynchronously.static voidsendMailCalendar(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, String strCalendarMessage, boolean bCreateEvent) Send a calendar message asynchronously.static voidsendMailCalendar(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, String strCalendarMessage, boolean bCreateEvent, boolean bUniqueRecipientTo) Send a calendar message asynchronously.static voidsendMailHtml(String strRecipientsTo, String strSenderName, String strSenderEmail, String strSubject, String strMessage) Send a HTML message asynchronously.static voidsendMailHtml(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage) Send a HTML message asynchronously.static voidsendMailHtml(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, boolean bUniqueRecipientTo) Send a HTML message asynchronously.static voidsendMailMultipartHtml(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, List<UrlAttachment> urlsAttachement, List<FileAttachment> filesAttachement) Send a HTML message asynchronously with the attachments associated to the message and attached files .static voidsendMailMultipartHtml(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, List<UrlAttachment> urlsAttachement, List<FileAttachment> filesAttachement, boolean bUniqueRecipientTo) Send a HTML message asynchronously with the attachments associated to the message and attached files .static voidsendMailMultipartHtml(String strRecipientsTo, String strSenderName, String strSenderEmail, String strSubject, String strMessage, List<UrlAttachment> urlsAttachement) Send a HTML message asynchronously with the attachments associated to the message .static voidsendMailMultipartText(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, List<FileAttachment> filesAttachement) Send a text message asynchronously with attached files.static voidsendMailMultipartText(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, List<FileAttachment> filesAttachement, boolean bUniqueRecipientTo) Send a text message asynchronously with attached files.static voidsendMailMultipartText(String strRecipientsTo, String strSenderName, String strSenderEmail, String strSubject, String strMessage, List<FileAttachment> filesAttachement) Send a text message asynchronously with attached files.static voidsendMailText(String strRecipientsTo, String strSenderName, String strSenderEmail, String strSubject, String strMessage) Send a text message asynchronously.static voidsendMailText(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage) Send a text message asynchronously.static voidsendMailText(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, boolean bUniqueRecipientTo) Send a text message asynchronously.static voidshutdown()Shutdown the service
-
Method Details
-
sendMailHtml
public static void sendMailHtml(String strRecipientsTo, String strSenderName, String strSenderEmail, String strSubject, String strMessage) Send a HTML message asynchronously. The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email.Every recipient must be separated by the mail separator define in config.propertiesstrSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.
-
sendMailHtml
public static void sendMailHtml(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage) Send a HTML message asynchronously. The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email.Every recipient must be separated by the mail separator defined in config.propertiesstrRecipientsCc- The recipients list of the carbon copies .strRecipientsBcc- The recipients list of the blind carbon copies .strSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.
-
sendMailHtml
public static void sendMailHtml(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, boolean bUniqueRecipientTo) Send a HTML message asynchronously. The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email.Every recipient must be separated by the mail separator defined in config.propertiesstrRecipientsCc- The recipients list of the carbon copies .strRecipientsBcc- The recipients list of the blind carbon copies .strSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.bUniqueRecipientTo- true if the mail must be send unitarily for each recipient
-
sendMailMultipartHtml
public static void sendMailMultipartHtml(String strRecipientsTo, String strSenderName, String strSenderEmail, String strSubject, String strMessage, List<UrlAttachment> urlsAttachement) Send a HTML message asynchronously with the attachments associated to the message . The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email.Every recipient must be separated by the mail separator defined in config.propertiesstrSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.urlsAttachement- The List of UrlAttachement Object, containing the URL of attachments associated with their content-location.
-
sendMailMultipartHtml
public static void sendMailMultipartHtml(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, List<UrlAttachment> urlsAttachement, List<FileAttachment> filesAttachement) Send a HTML message asynchronously with the attachments associated to the message and attached files . The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email.Every recipient must be separated by the mail separator defined in config.propertiesstrRecipientsCc- The recipients list of the carbon copies .strRecipientsBcc- The recipients list of the blind carbon copies .strSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.urlsAttachement- The List of UrlAttachement Object, containing the URL of attachments associated with their content-locationfilesAttachement- The list of attached files.
-
sendMailMultipartHtml
public static void sendMailMultipartHtml(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, List<UrlAttachment> urlsAttachement, List<FileAttachment> filesAttachement, boolean bUniqueRecipientTo) Send a HTML message asynchronously with the attachments associated to the message and attached files . The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email.Every recipient must be separated by the mail separator defined in config.propertiesstrRecipientsCc- The recipients list of the carbon copies .strRecipientsBcc- The recipients list of the blind carbon copies .strSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.urlsAttachement- The List of UrlAttachement Object, containing the URL of attachments associated with their content-locationfilesAttachement- The list of attached files.bUniqueRecipientTo- true if the mail must be send unitarily for each recipient
-
sendMailCalendar
public static void sendMailCalendar(String strRecipientsTo, String strSenderName, String strSenderEmail, String strSubject, String strMessage, String strCalendarMessage, boolean bCreateEvent) Send a calendar message asynchronously. The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email. Every recipient must be separated by the mail separator defined in config.propertiesstrSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.strCalendarMessage- The calendar messagebCreateEvent- True to create the calendar event, false to remove it
-
sendMailCalendar
public static void sendMailCalendar(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, String strCalendarMessage, boolean bCreateEvent) Send a calendar message asynchronously. The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email. Every recipient must be separated by the mail separator defined in config.propertiesstrRecipientsCc- The recipients list of the carbon copies .strRecipientsBcc- The recipients list of the blind carbon copies .strSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.strCalendarMessage- The calendar messagebCreateEvent- True to create the calendar event, false to remove it
-
sendMailCalendar
public static void sendMailCalendar(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, String strCalendarMessage, boolean bCreateEvent, boolean bUniqueRecipientTo) Send a calendar message asynchronously. The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email. Every recipient must be separated by the mail separator defined in config.propertiesstrRecipientsCc- The recipients list of the carbon copies .strRecipientsBcc- The recipients list of the blind carbon copies .strSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.strCalendarMessage- The calendar messagebCreateEvent- True to create the calendar event, false to remove itbUniqueRecipientTo- true if the mail must be send unitarily for each recipient
-
sendMailText
public static void sendMailText(String strRecipientsTo, String strSenderName, String strSenderEmail, String strSubject, String strMessage) Send a text message asynchronously. The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email. Every recipient must be separated by the mail separator defined in config.propertiesstrSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.
-
sendMailText
public static void sendMailText(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage) Send a text message asynchronously. The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email. Every recipient must be separated by the mail separator defined in config.propertiesstrRecipientsCc- The recipients list of the carbon copies .strRecipientsBcc- The recipients list of the blind carbon copies .strSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.
-
sendMailText
public static void sendMailText(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, boolean bUniqueRecipientTo) Send a text message asynchronously. The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email. Every recipient must be separated by the mail separator defined in config.propertiesstrRecipientsCc- The recipients list of the carbon copies .strRecipientsBcc- The recipients list of the blind carbon copies .strSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.bUniqueRecipientTo- true if the mail must be send unitarily for each recipient
-
sendMailMultipartText
public static void sendMailMultipartText(String strRecipientsTo, String strSenderName, String strSenderEmail, String strSubject, String strMessage, List<FileAttachment> filesAttachement) Send a text message asynchronously with attached files. The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email.Every recipient must be separated by the mail separator defined in config.propertiesstrSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.filesAttachement- The list of attached files.
-
sendMailMultipartText
public static void sendMailMultipartText(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, List<FileAttachment> filesAttachement) Send a text message asynchronously with attached files. The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email.Every recipient must be separated by the mail separator defined in config.propertiesstrRecipientsCc- The recipients list of the carbon copies .strRecipientsBcc- The recipients list of the blind carbon copies .strSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.filesAttachement- The list of attached files.
-
sendMailMultipartText
public static void sendMailMultipartText(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, List<FileAttachment> filesAttachement, boolean bUniqueRecipientTo) Send a text message asynchronously with attached files. The message is queued until a daemon thread send all awaiting messages- Parameters:
strRecipientsTo- The list of the main recipients email.Every recipient must be separated by the mail separator defined in config.propertiesstrRecipientsCc- The recipients list of the carbon copies .strRecipientsBcc- The recipients list of the blind carbon copies .strSenderName- The sender name.strSenderEmail- The sender email address.strSubject- The message subject.strMessage- The message.filesAttachement- The list of attached files.bUniqueRecipientTo- true if the mail must be send unitarily for each recipient
-
shutdown
public static void shutdown()Shutdown the service -
getNoReplyEmail
Returns a no reply email address defined in config.properties- Returns:
- A no reply email
-
getQueue
Returns the mail queue- Returns:
- the mail queue
-
getUrlAttachmentList
public static List<UrlAttachment> getUrlAttachmentList(String strHtml, String strBaseUrl, boolean useAbsoluteUrl) Extract a collection of elements to be attached to a mail from an HTML string. The collection contains the Url used for created DataHandler for each url associated with an HTML tag img, script or link. Those urls must start with the url strBaseUrl.- Parameters:
strHtml- The HTML code.strBaseUrl- The base url, can be null in order to extract all urls.useAbsoluteUrl- Determine if we use absolute or relative url for attachement content-location- Returns:
- a collection of UrlAttachment Object for created DataHandler associated with attachment urls.
-
getStrRecipients
Return a String that contains a list of recipients separated with mail separator- Parameters:
listRecipients- a list of string recipients- Returns:
- a String that contains a list of recipients separated with mail separator
-
getSiteLink
Get a string that contains an html link to the site back office or front office.- Parameters:
strBaseUrl- The base url of the sitelinkToFrontOffice- True if the link should be directed to the front office, false if it should be directed to the back office.- Returns:
- A string containing an html link.
-