fr.paris.lutece.portal.service.mail
Class MailService

java.lang.Object
  extended by fr.paris.lutece.portal.service.mail.MailService

public final class MailService
extends java.lang.Object

Application Mail Service


Method Summary
static java.lang.String getNoReplyEmail()
          Returns a no reply email address defined in config.properties
static IMailQueue getQueue()
          Returns the mail queue
static java.lang.String getStrRecipients(java.util.List<java.lang.String> listRecipients)
          Return a String that contains a list of recipients separated with mail separator
static java.util.List<UrlAttachment> getUrlAttachmentList(java.lang.String strHtml, java.lang.String strBaseUrl, boolean useAbsoluteUrl)
          Extract a collection of elements to be attached to a mail from an HTML string.
static void sendMail(java.lang.String strRecipient, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage)
          Deprecated.  
static void sendMailHtml(java.lang.String strRecipientsTo, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage)
          Send a HTML message asynchronously.
static void sendMailHtml(java.lang.String strRecipientsTo, java.lang.String strRecipientsCc, java.lang.String strRecipientsBcc, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage)
          Send a HTML message asynchronously.
static void sendMailHtml(java.lang.String strRecipientsTo, java.lang.String strRecipientsCc, java.lang.String strRecipientsBcc, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage, boolean bUniqueRecipientTo)
          Send a HTML message asynchronously.
static void sendMailMultipartHtml(java.lang.String strRecipientsTo, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage, java.util.List<UrlAttachment> urlsAttachement)
          Send a HTML message asynchronously with the attachements associated to the message .
static void sendMailMultipartHtml(java.lang.String strRecipientsTo, java.lang.String strRecipientsCc, java.lang.String strRecipientsBcc, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage, java.util.List<UrlAttachment> urlsAttachement, java.util.List<FileAttachment> filesAttachement)
          Send a HTML message asynchronously with the attachements associated to the message and attached files .
static void sendMailMultipartHtml(java.lang.String strRecipientsTo, java.lang.String strRecipientsCc, java.lang.String strRecipientsBcc, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage, java.util.List<UrlAttachment> urlsAttachement, java.util.List<FileAttachment> filesAttachement, boolean bUniqueRecipientTo)
          Send a HTML message asynchronously with the attachements associated to the message and attached files .
static void sendMailMultipartText(java.lang.String strRecipientsTo, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage, java.util.List<FileAttachment> filesAttachement)
          Send a text message asynchronously with attached files.
static void sendMailMultipartText(java.lang.String strRecipientsTo, java.lang.String strRecipientsCc, java.lang.String strRecipientsBcc, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage, java.util.List<FileAttachment> filesAttachement)
          Send a text message asynchronously with attached files.
static void sendMailMultipartText(java.lang.String strRecipientsTo, java.lang.String strRecipientsCc, java.lang.String strRecipientsBcc, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage, java.util.List<FileAttachment> filesAttachement, boolean bUniqueRecipientTo)
          Send a text message asynchronously with attached files.
static void sendMailText(java.lang.String strRecipientsTo, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage)
          Send a text message asynchronously.
static void sendMailText(java.lang.String strRecipientsTo, java.lang.String strRecipientsCc, java.lang.String strRecipientsBcc, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage)
          Send a text message asynchronously.
static void sendMailText(java.lang.String strRecipientsTo, java.lang.String strRecipientsCc, java.lang.String strRecipientsBcc, java.lang.String strSenderName, java.lang.String strSenderEmail, java.lang.String strSubject, java.lang.String strMessage, boolean bUniqueRecipientTo)
          Send a text message asynchronously.
static void shutdown()
          Shutdown the service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sendMail

public static void sendMail(java.lang.String strRecipient,
                            java.lang.String strSenderName,
                            java.lang.String strSenderEmail,
                            java.lang.String strSubject,
                            java.lang.String strMessage)
Deprecated. 

Send a message asynchronously. The message is queued until a daemon thread send all awaiting messages

Parameters:
strRecipient - The recipient email.
strSenderName - The sender name.
strSenderEmail - The sender email address.
strSubject - The message subject.
strMessage - The message.

sendMailHtml

public static void sendMailHtml(java.lang.String strRecipientsTo,
                                java.lang.String strSenderName,
                                java.lang.String strSenderEmail,
                                java.lang.String strSubject,
                                java.lang.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.properties
strSenderName - The sender name.
strSenderEmail - The sender email address.
strSubject - The message subject.
strMessage - The message.

sendMailHtml

public static void sendMailHtml(java.lang.String strRecipientsTo,
                                java.lang.String strRecipientsCc,
                                java.lang.String strRecipientsBcc,
                                java.lang.String strSenderName,
                                java.lang.String strSenderEmail,
                                java.lang.String strSubject,
                                java.lang.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.properties
strRecipientsCc - 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(java.lang.String strRecipientsTo,
                                java.lang.String strRecipientsCc,
                                java.lang.String strRecipientsBcc,
                                java.lang.String strSenderName,
                                java.lang.String strSenderEmail,
                                java.lang.String strSubject,
                                java.lang.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.properties
strRecipientsCc - 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(java.lang.String strRecipientsTo,
                                         java.lang.String strSenderName,
                                         java.lang.String strSenderEmail,
                                         java.lang.String strSubject,
                                         java.lang.String strMessage,
                                         java.util.List<UrlAttachment> urlsAttachement)
Send a HTML message asynchronously with the attachements 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.properties
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-location.

sendMailMultipartHtml

public static void sendMailMultipartHtml(java.lang.String strRecipientsTo,
                                         java.lang.String strRecipientsCc,
                                         java.lang.String strRecipientsBcc,
                                         java.lang.String strSenderName,
                                         java.lang.String strSenderEmail,
                                         java.lang.String strSubject,
                                         java.lang.String strMessage,
                                         java.util.List<UrlAttachment> urlsAttachement,
                                         java.util.List<FileAttachment> filesAttachement)
Send a HTML message asynchronously with the attachements 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.properties
strRecipientsCc - 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-location
filesAttachement - The list of attached files.

sendMailMultipartHtml

public static void sendMailMultipartHtml(java.lang.String strRecipientsTo,
                                         java.lang.String strRecipientsCc,
                                         java.lang.String strRecipientsBcc,
                                         java.lang.String strSenderName,
                                         java.lang.String strSenderEmail,
                                         java.lang.String strSubject,
                                         java.lang.String strMessage,
                                         java.util.List<UrlAttachment> urlsAttachement,
                                         java.util.List<FileAttachment> filesAttachement,
                                         boolean bUniqueRecipientTo)
Send a HTML message asynchronously with the attachements 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.properties
strRecipientsCc - 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-location
filesAttachement - The list of attached files.
bUniqueRecipientTo - true if the mail must be send unitarily for each recipient

sendMailText

public static void sendMailText(java.lang.String strRecipientsTo,
                                java.lang.String strSenderName,
                                java.lang.String strSenderEmail,
                                java.lang.String strSubject,
                                java.lang.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.properties
strSenderName - The sender name.
strSenderEmail - The sender email address.
strSubject - The message subject.
strMessage - The message.

sendMailText

public static void sendMailText(java.lang.String strRecipientsTo,
                                java.lang.String strRecipientsCc,
                                java.lang.String strRecipientsBcc,
                                java.lang.String strSenderName,
                                java.lang.String strSenderEmail,
                                java.lang.String strSubject,
                                java.lang.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.properties
strRecipientsCc - 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(java.lang.String strRecipientsTo,
                                java.lang.String strRecipientsCc,
                                java.lang.String strRecipientsBcc,
                                java.lang.String strSenderName,
                                java.lang.String strSenderEmail,
                                java.lang.String strSubject,
                                java.lang.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.properties
strRecipientsCc - 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(java.lang.String strRecipientsTo,
                                         java.lang.String strSenderName,
                                         java.lang.String strSenderEmail,
                                         java.lang.String strSubject,
                                         java.lang.String strMessage,
                                         java.util.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.properties
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(java.lang.String strRecipientsTo,
                                         java.lang.String strRecipientsCc,
                                         java.lang.String strRecipientsBcc,
                                         java.lang.String strSenderName,
                                         java.lang.String strSenderEmail,
                                         java.lang.String strSubject,
                                         java.lang.String strMessage,
                                         java.util.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.properties
strRecipientsCc - 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(java.lang.String strRecipientsTo,
                                         java.lang.String strRecipientsCc,
                                         java.lang.String strRecipientsBcc,
                                         java.lang.String strSenderName,
                                         java.lang.String strSenderEmail,
                                         java.lang.String strSubject,
                                         java.lang.String strMessage,
                                         java.util.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.properties
strRecipientsCc - 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

public static java.lang.String getNoReplyEmail()
Returns a no reply email address defined in config.properties

Returns:
A no reply email

getQueue

public static IMailQueue getQueue()
Returns the mail queue

Returns:
the mail queue

getUrlAttachmentList

public static java.util.List<UrlAttachment> getUrlAttachmentList(java.lang.String strHtml,
                                                                 java.lang.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

public static java.lang.String getStrRecipients(java.util.List<java.lang.String> listRecipients)
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


Copyright © 2011 Mairie de Paris. All Rights Reserved.