Class MailService

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

public final class MailService extends Object
Application Mail 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.properties
      strSenderName - The sender name.
      strSenderEmail - The sender email address.
      strSubject - The message subject.
      strMessage - The message.
    • sendMailHtml

      public static void sendMailHtml(String strRecipientsTo, String strSenderName, String strSenderEmail, String strSubject, String strMessage, String strReplyTo)
      Send a HTML message asynchronously with a Reply-To address. 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.
      strReplyTo - The Reply-To email address.
    • 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.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(String strRecipientsTo, String strRecipientsCc, String strRecipientsBcc, String strSenderName, String strSenderEmail, String strSubject, String strMessage, String strReplyTo)
      Send a HTML message asynchronously with a Reply-To address. 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.
      strReplyTo - The Reply-To email address.
    • 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.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(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.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(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.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(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.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
    • 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.properties
      strSenderName - The sender name.
      strSenderEmail - The sender email address.
      strSubject - The message subject.
      strMessage - The message.
      strCalendarMessage - The calendar message
      bCreateEvent - 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.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.
      strCalendarMessage - The calendar message
      bCreateEvent - 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.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.
      strCalendarMessage - The calendar message
      bCreateEvent - True to create the calendar event, false to remove it
      bUniqueRecipientTo - 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.properties
      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)
      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(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.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(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.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(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.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(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.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 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 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

      public static String getStrRecipients(List<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
    • getSiteLink

      public static String getSiteLink(String strBaseUrl, boolean linkToFrontOffice)
      Get a string that contains an html link to the site back office or front office.
      Parameters:
      strBaseUrl - The base url of the site
      linkToFrontOffice - 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.