Example #1
0
  /**
   * Send a text message asynchronously with attached files. The message is queued until a daemon
   * thread send all awaiting messages
   *
   * @param strRecipientsTo The list of the main recipients email.Every recipient must be separated
   *     by the mail separator defined in config.properties
   * @param strRecipientsCc The recipients list of the carbon copies .
   * @param strRecipientsBcc The recipients list of the blind carbon copies .
   * @param strSenderName The sender name.
   * @param strSenderEmail The sender email address.
   * @param strSubject The message subject.
   * @param strMessage The message.
   * @param filesAttachement The list of attached files.
   * @param bUniqueRecipientTo true if the mail must be send unitarily for each recipient
   */
  public static void sendMailMultipartText(
      String strRecipientsTo,
      String strRecipientsCc,
      String strRecipientsBcc,
      String strSenderName,
      String strSenderEmail,
      String strSubject,
      String strMessage,
      List<FileAttachment> filesAttachement,
      boolean bUniqueRecipientTo) {
    MailItem item = new MailItem();
    item.setRecipientsTo(strRecipientsTo);
    item.setRecipientsCc(strRecipientsCc);
    item.setRecipientsBcc(strRecipientsBcc);
    item.setSenderName(strSenderName);
    item.setSenderEmail(strSenderEmail);
    item.setSubject(strSubject);
    item.setMessage(strMessage);
    item.setFormat(MailItem.FORMAT_MULTIPART_TEXT);
    item.setFilesAttachement(filesAttachement);
    item.setUniqueRecipientTo(bUniqueRecipientTo);

    IMailQueue queue = (IMailQueue) SpringContextService.getBean(BEAN_MAIL_QUEUE);
    queue.send(item);
  }
Example #2
0
  /**
   * Send a calendar message asynchronously. The message is queued until a daemon thread send all
   * awaiting messages
   *
   * @param strRecipientsTo The list of the main recipients email. Every recipient must be separated
   *     by the mail separator defined in config.properties
   * @param strRecipientsCc The recipients list of the carbon copies .
   * @param strRecipientsBcc The recipients list of the blind carbon copies .
   * @param strSenderName The sender name.
   * @param strSenderEmail The sender email address.
   * @param strSubject The message subject.
   * @param strMessage The message.
   * @param strCalendarMessage The calendar message
   * @param bCreateEvent True to create the calendar event, false to remove it
   * @param bUniqueRecipientTo true if the mail must be send unitarily for each recipient
   */
  public static void sendMailCalendar(
      String strRecipientsTo,
      String strRecipientsCc,
      String strRecipientsBcc,
      String strSenderName,
      String strSenderEmail,
      String strSubject,
      String strMessage,
      String strCalendarMessage,
      boolean bCreateEvent,
      boolean bUniqueRecipientTo) {
    MailItem item = new MailItem();
    item.setRecipientsTo(strRecipientsTo);
    item.setRecipientsCc(strRecipientsCc);
    item.setRecipientsBcc(strRecipientsBcc);
    item.setSenderName(strSenderName);
    item.setSenderEmail(strSenderEmail);
    item.setSubject(strSubject);
    item.setMessage(strMessage);
    item.setCalendarMessage(strCalendarMessage);
    item.setCreateEvent(bCreateEvent);
    item.setFormat(MailItem.FORMAT_CALENDAR);
    item.setUniqueRecipientTo(bUniqueRecipientTo);

    IMailQueue queue = (IMailQueue) SpringContextService.getBean(BEAN_MAIL_QUEUE);
    queue.send(item);
  }