Class Mail


  • public class Mail
    extends java.lang.Object
    Send emails thru standard mail service or Outlook thru Java Outlook Connector
    • Constructor Summary

      Constructors 
      Constructor Description
      Mail()
      Deprecated. 
      Mail​(Grant grant)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Mail.MailAttach documentAttach​(ObjectDB obj, ObjectField f)
      Get attachment from object field
      Mail.MailImage documentImage​(ObjectDB obj, ObjectField f)
      Get inlined image from object field
      Mail.MailImage documentImage​(ObjectDB obj, ObjectField f, boolean thumbnail)
      Get inlined image from object field
      static java.lang.String getAddressPart​(java.lang.String addr)
      Get the plain email address part of a full email address string
      static java.lang.String getNamePart​(java.lang.String addr)
      Get the plain name part of a full email address string
      static Mail.MailAttach getResourceAttach​(Grant g, java.lang.Object o, java.lang.String type, java.lang.String code)
      Get attachment from resource
      static Mail.MailImage getResourceImage​(Grant g, java.lang.Object o, java.lang.String type, java.lang.String code, boolean thumbnail)
      Get inlined image from resource
      Mail.MailAttach objectAttach​(ObjectDB obj, java.lang.String templateName)  
      Mail.MailAttach resourceAttach​(ExternalObject ext, java.lang.String type, java.lang.String code)
      Get attachment from external object resource
      Mail.MailAttach resourceAttach​(ObjectDB obj, java.lang.String type, java.lang.String code)
      Get attachment from object resource
      Mail.MailAttach resourceAttach​(java.lang.String type, java.lang.String code)
      Get attachment from disposition resource
      Mail.MailImage resourceIcon​(ExternalObject ext, java.lang.String code, boolean thumbnail)
      Get inlined image from object icon resource
      Mail.MailImage resourceIcon​(ObjectDB obj, java.lang.String code, boolean thumbnail)
      Get inlined image from object icon resource
      Mail.MailImage resourceIcon​(java.lang.String code, boolean thumbnail)
      Get inlined image from icon disposition resource
      Mail.MailImage resourceImage​(ExternalObject ext, java.lang.String code, boolean thumbnail)
      Get inlined image from external object resource
      Mail.MailImage resourceImage​(ObjectDB obj, java.lang.String code, boolean thumbnail)
      Get inlined image from object resource
      Mail.MailImage resourceImage​(java.lang.String code, boolean thumbnail)
      Get inlined image from disposition resource
      boolean send​(java.lang.String[] to, java.lang.String from, java.lang.String[] cc, java.lang.String[] bcc, java.lang.String subject, java.lang.String body)
      Send a simple email thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
      boolean send​(java.lang.String[] to, java.lang.String from, java.lang.String[] cc, java.lang.String[] bcc, java.lang.String subject, java.lang.String body, java.lang.String mime)
      Send a simple email thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
      boolean send​(java.lang.String[] to, java.lang.String from, java.lang.String[] cc, java.lang.String subject, java.lang.String body)
      Send a simple email thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
      boolean send​(java.lang.String to, java.lang.String from, java.lang.String subject, java.lang.String body)
      Send a simple email thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
      boolean sendInvitation​(java.util.Date start, java.util.Date end, java.lang.String location, java.lang.String organizerEmail, java.lang.String organizerName, java.lang.String[] attendeeEmails, java.lang.String[] attendeeNames, java.lang.String[] ccAttendeeEmails, java.lang.String[] ccAttendeeNames, java.lang.String[] bccAttendeeEmails, java.lang.String[] bccAttendeeNames, java.lang.String summary, java.lang.String shortDescription, java.lang.String longDescription, Mail.MailAttach[] attachs)
      Send an initation to an event to several attendees and several cc/bcc attendees
      boolean sendInvitation​(java.util.Date start, java.util.Date end, java.lang.String location, java.lang.String organizerEmail, java.lang.String organizerName, java.lang.String[] attendeeEmails, java.lang.String[] attendeeNames, java.lang.String summary, java.lang.String shortDescription, java.lang.String longDescription)
      Send an initation to an event to several attendees
      boolean sendInvitation​(java.util.Date start, java.util.Date end, java.lang.String location, java.lang.String organizerEmail, java.lang.String organizerName, java.lang.String attendeeEmail, java.lang.String attendeeName, java.lang.String summary, java.lang.String shortDescription, java.lang.String longDescription)
      Send an initation to an event to one attendee
      boolean sendWithAttach​(java.lang.String[] to, java.lang.String from, java.lang.String[] cc, java.lang.String[] bcc, java.lang.String subject, java.lang.String body, java.lang.String mime, java.lang.String[] files, Mail.MailAttach[] attachs)
      Send an email with attachments thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
      boolean sendWithAttach​(java.lang.String[] to, java.lang.String from, java.lang.String[] cc, java.lang.String[] bcc, java.lang.String subject, java.lang.String body, java.lang.String mime, java.lang.String[] files, Mail.MailAttach[] attachs, Mail.MailImage[] images)
      Send an email with attachments thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
      boolean sendWithAttach​(java.lang.String[] to, java.lang.String from, java.lang.String replyTo, java.lang.String[] cc, java.lang.String[] bcc, java.lang.String subject, java.lang.String body, java.lang.String mime, java.lang.String[] files, Mail.MailAttach[] attachs, Mail.MailImage[] images)
      Send an email with attachments thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
      boolean sendWithAttach​(java.lang.String to, java.lang.String from, java.lang.String cc, java.lang.String bcc, java.lang.String subject, java.lang.String body, java.lang.String mime, Mail.MailAttach[] attachs)
      Send an email with attachments thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
      boolean sendWithAttach​(java.lang.String to, java.lang.String from, java.lang.String cc, java.lang.String bcc, java.lang.String subject, java.lang.String body, java.lang.String mime, java.lang.String[] files)
      Send an email with attachments thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
      Mail.MailAttach vCalendarAttach​(VCalendarTool.VCalendarEvent[] events, Grant g)
      Build an attachement vCalendar
      Mail.MailAttach vCalendarAttach​(VCalendarTool.VCalendarEvent[] events, Grant g, java.lang.String attachName)
      Build an attachement vCalendar
      Mail.MailAttach vCalendarAttach​(VCalendarTool.VCalendarEvent event, Grant g)
      Build an attachement vCalendar
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MAIL_MIME_TYPE_HTML

        public static final java.lang.String MAIL_MIME_TYPE_HTML
      • MAIL_MIME_TYPE_TEXT

        public static final java.lang.String MAIL_MIME_TYPE_TEXT
    • Constructor Detail

      • Mail

        @Deprecated
        public Mail()
        Deprecated.

        Use Mail(grant)

      • Mail

        public Mail​(Grant grant)
    • Method Detail

      • vCalendarAttach

        public Mail.MailAttach vCalendarAttach​(VCalendarTool.VCalendarEvent[] events,
                                               Grant g,
                                               java.lang.String attachName)
        Build an attachement vCalendar
        Parameters:
        events - Calendar events
        g - Grant (can be null then dates are generated as UTC)
        attachName - Attachement name (can be null then calendar.ics is used)
      • resourceAttach

        public Mail.MailAttach resourceAttach​(java.lang.String type,
                                              java.lang.String code)
        Get attachment from disposition resource
        Parameters:
        type - Resource type
        code - Resource code
      • resourceAttach

        public Mail.MailAttach resourceAttach​(ObjectDB obj,
                                              java.lang.String type,
                                              java.lang.String code)
        Get attachment from object resource
        Parameters:
        obj - Object
        type - Resource type
        code - Resource code
      • resourceAttach

        public Mail.MailAttach resourceAttach​(ExternalObject ext,
                                              java.lang.String type,
                                              java.lang.String code)
        Get attachment from external object resource
        Parameters:
        ext - External object
        type - Resource type
        code - Resource code
      • getResourceAttach

        public static Mail.MailAttach getResourceAttach​(Grant g,
                                                        java.lang.Object o,
                                                        java.lang.String type,
                                                        java.lang.String code)
        Get attachment from resource
        Parameters:
        g - Grant
        o - Resource owner: null (disposition) or business object or external object
        type - Resource type
        code - Resource code
      • documentImage

        public Mail.MailImage documentImage​(ObjectDB obj,
                                            ObjectField f)
        Get inlined image from object field
        Parameters:
        obj - Object
        f - Field (must be document or image type)
      • documentImage

        public Mail.MailImage documentImage​(ObjectDB obj,
                                            ObjectField f,
                                            boolean thumbnail)
        Get inlined image from object field
        Parameters:
        obj - Object
        f - Field (document or image)
        thumbnail - Use thumbnail (only applicable to image field type)?
      • resourceImage

        public Mail.MailImage resourceImage​(java.lang.String code,
                                            boolean thumbnail)
        Get inlined image from disposition resource
        Parameters:
        code - Resource code
        thumbnail - Use thumbnail?
      • resourceIcon

        public Mail.MailImage resourceIcon​(java.lang.String code,
                                           boolean thumbnail)
        Get inlined image from icon disposition resource
        Parameters:
        code - Resource code
        thumbnail - Use thumbnail?
      • resourceImage

        public Mail.MailImage resourceImage​(ObjectDB obj,
                                            java.lang.String code,
                                            boolean thumbnail)
        Get inlined image from object resource
        Parameters:
        obj - Object
        code - Resource code
        thumbnail - Use thumbnail?
      • resourceIcon

        public Mail.MailImage resourceIcon​(ObjectDB obj,
                                           java.lang.String code,
                                           boolean thumbnail)
        Get inlined image from object icon resource
        Parameters:
        obj - Object
        code - Resource code
        thumbnail - Use thumbnail?
      • resourceImage

        public Mail.MailImage resourceImage​(ExternalObject ext,
                                            java.lang.String code,
                                            boolean thumbnail)
        Get inlined image from external object resource
        Parameters:
        ext - External object
        code - Resource code
        thumbnail - Use thumbnail?
      • resourceIcon

        public Mail.MailImage resourceIcon​(ExternalObject ext,
                                           java.lang.String code,
                                           boolean thumbnail)
        Get inlined image from object icon resource
        Parameters:
        ext - External object
        code - Resource code
        thumbnail - Use thumbnail?
      • getResourceImage

        public static Mail.MailImage getResourceImage​(Grant g,
                                                      java.lang.Object o,
                                                      java.lang.String type,
                                                      java.lang.String code,
                                                      boolean thumbnail)
        Get inlined image from resource
        Parameters:
        g - Grant
        o - Resource owner: null (disposition) or business object or external object
        type - Resource type
        code - Resource code
        thumbnail -
      • send

        public boolean send​(java.lang.String to,
                            java.lang.String from,
                            java.lang.String subject,
                            java.lang.String body)
        Send a simple email thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
        Parameters:
        to - Recipient email
        from - Sender email
        subject - Email subject
        body - Mail content (MIME type is forced to HTML if <html> is found in body)
      • send

        public boolean send​(java.lang.String[] to,
                            java.lang.String from,
                            java.lang.String[] cc,
                            java.lang.String subject,
                            java.lang.String body)
        Send a simple email thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
        Parameters:
        to - Recipient emails
        from - Sender email
        cc - Copies emails
        subject - Email subject
        body - Mail content (MIME type is forced to HTML if <html> is found in body)
      • send

        public boolean send​(java.lang.String[] to,
                            java.lang.String from,
                            java.lang.String[] cc,
                            java.lang.String[] bcc,
                            java.lang.String subject,
                            java.lang.String body)
        Send a simple email thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
        Parameters:
        to - Recipient emails
        from - Sender email
        cc - Copies emails
        bcc - Blind copies
        subject - Email subject
        body - Mail content (MIME type is forced to HTML if <html> is found in body)
      • send

        public boolean send​(java.lang.String[] to,
                            java.lang.String from,
                            java.lang.String[] cc,
                            java.lang.String[] bcc,
                            java.lang.String subject,
                            java.lang.String body,
                            java.lang.String mime)
        Send a simple email thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
        Parameters:
        to - Recipient emails
        from - Sender email
        cc - Copies emails
        bcc - Blind copies
        subject - Email subject
        body - Mail content (MIME type is forced to HTML if <html> is found in body)
        mime - Content mime (plain text if null)
      • sendWithAttach

        public boolean sendWithAttach​(java.lang.String to,
                                      java.lang.String from,
                                      java.lang.String cc,
                                      java.lang.String bcc,
                                      java.lang.String subject,
                                      java.lang.String body,
                                      java.lang.String mime,
                                      java.lang.String[] files)
        Send an email with attachments thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
        Parameters:
        to - Recipient emails
        from - Sender email
        cc - Copies emails
        bcc - Blind copies
        subject - Email subject
        body - Mail content
        mime - Content mime (plain text if null)
        files - Files to attach
      • sendWithAttach

        public boolean sendWithAttach​(java.lang.String to,
                                      java.lang.String from,
                                      java.lang.String cc,
                                      java.lang.String bcc,
                                      java.lang.String subject,
                                      java.lang.String body,
                                      java.lang.String mime,
                                      Mail.MailAttach[] attachs)
        Send an email with attachments thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
        Parameters:
        to - Recipient emails
        from - Sender email
        cc - Copies emails
        bcc - Blind copies
        subject - Email subject
        body - Mail content
        mime - Content mime (plain text if null)
        attachs - Objects attachment
      • sendWithAttach

        public boolean sendWithAttach​(java.lang.String[] to,
                                      java.lang.String from,
                                      java.lang.String[] cc,
                                      java.lang.String[] bcc,
                                      java.lang.String subject,
                                      java.lang.String body,
                                      java.lang.String mime,
                                      java.lang.String[] files,
                                      Mail.MailAttach[] attachs)
        Send an email with attachments thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
        Parameters:
        to - Recipient emails
        from - Sender email
        cc - Copies emails
        bcc - Blind copies
        subject - Email subject
        body - Mail content
        mime - Content mime (plain text if null)
        files - Files to attach
        attachs - Objects attachment
      • sendWithAttach

        public boolean sendWithAttach​(java.lang.String[] to,
                                      java.lang.String from,
                                      java.lang.String[] cc,
                                      java.lang.String[] bcc,
                                      java.lang.String subject,
                                      java.lang.String body,
                                      java.lang.String mime,
                                      java.lang.String[] files,
                                      Mail.MailAttach[] attachs,
                                      Mail.MailImage[] images)
        Send an email with attachments thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
        Parameters:
        to - Recipient emails
        from - Sender email
        cc - Copies emails
        bcc - Blind copies
        subject - Email subject
        body - Mail content
        mime - Content mime (plain text if null)
        files - Files to attach
        attachs - Objects attachment
        images - Inlined images
      • sendWithAttach

        public boolean sendWithAttach​(java.lang.String[] to,
                                      java.lang.String from,
                                      java.lang.String replyTo,
                                      java.lang.String[] cc,
                                      java.lang.String[] bcc,
                                      java.lang.String subject,
                                      java.lang.String body,
                                      java.lang.String mime,
                                      java.lang.String[] files,
                                      Mail.MailAttach[] attachs,
                                      Mail.MailImage[] images)
        Send an email with attachments thru JavaMail or Outlook client (when system param EMAIL_SEND_OUTLOOK = yes)
        Parameters:
        to - Recipient emails
        from - Sender email
        replyTo - Reply email
        cc - Copies emails
        bcc - Blind copies
        subject - Email subject
        body - Mail content
        mime - Content mime (plain text if null)
        files - Files to attach
        attachs - Objects attachment
        images - Inlined images
      • getAddressPart

        public static java.lang.String getAddressPart​(java.lang.String addr)
        Get the plain email address part of a full email address string
        Parameters:
        addr - Full email address string
        Returns:
        Plain email address part
      • getNamePart

        public static java.lang.String getNamePart​(java.lang.String addr)
        Get the plain name part of a full email address string
        Parameters:
        addr - Full email address string
        Returns:
        Plain name part
      • sendInvitation

        public boolean sendInvitation​(java.util.Date start,
                                      java.util.Date end,
                                      java.lang.String location,
                                      java.lang.String organizerEmail,
                                      java.lang.String organizerName,
                                      java.lang.String attendeeEmail,
                                      java.lang.String attendeeName,
                                      java.lang.String summary,
                                      java.lang.String shortDescription,
                                      java.lang.String longDescription)

        Send an initation to an event to one attendee

        Parameters:
        start - Event start date
        end - Event end date
        location - Event location
        organizerEmail - Event organizer email
        organizerName - Event organizer name
        attendeeEmail - Event attendee email
        attendeeName - Event attendee name
        summary - Event summary (used as invitation email object and vCard summary)
        shortDescription - Event short description (used as vCard description)
        longDescription - Event long description (used as email body with HTML MIME type)
      • sendInvitation

        public boolean sendInvitation​(java.util.Date start,
                                      java.util.Date end,
                                      java.lang.String location,
                                      java.lang.String organizerEmail,
                                      java.lang.String organizerName,
                                      java.lang.String[] attendeeEmails,
                                      java.lang.String[] attendeeNames,
                                      java.lang.String summary,
                                      java.lang.String shortDescription,
                                      java.lang.String longDescription)

        Send an initation to an event to several attendees

        Parameters:
        start - Event start date
        end - Event end date
        location - Event location
        organizerEmail - Event organizer email
        organizerName - Event organizer name
        attendeeEmails - Event attendee emails
        attendeeNames - Event attendee names
        summary - Event summary (used as invitation email object and vCard summary)
        shortDescription - Event short description (used as vCard description)
        longDescription - Event long description (used as email body with HTML MIME type)
      • sendInvitation

        public boolean sendInvitation​(java.util.Date start,
                                      java.util.Date end,
                                      java.lang.String location,
                                      java.lang.String organizerEmail,
                                      java.lang.String organizerName,
                                      java.lang.String[] attendeeEmails,
                                      java.lang.String[] attendeeNames,
                                      java.lang.String[] ccAttendeeEmails,
                                      java.lang.String[] ccAttendeeNames,
                                      java.lang.String[] bccAttendeeEmails,
                                      java.lang.String[] bccAttendeeNames,
                                      java.lang.String summary,
                                      java.lang.String shortDescription,
                                      java.lang.String longDescription,
                                      Mail.MailAttach[] attachs)

        Send an initation to an event to several attendees and several cc/bcc attendees

        Parameters:
        start - Event start date
        end - Event end date
        location - Event location
        organizerEmail - Event organizer email
        organizerName - Event organizer name
        attendeeEmails - Event attendee emails
        attendeeNames - Event attendee names
        ccAttendeeEmails - Event CC attendee emails
        ccAttendeeNames - Event CC attendee names
        bccAttendeeEmails - Event BCC attendee emails
        bccAttendeeNames - Event BCC attendee names
        summary - Event summary (used as invitation email object and vCard summary)
        shortDescription - Event short description (used as vCard description)
        longDescription - Event long description (used as email body with HTML MIME type)
        attachs - Objects attachment