Class MailSending


  • public class MailSending
    extends Object
    Handles easily the send of an email. It deals with centralized mechanism that ensures a synchronized use of mail services (SMTP server connexion for example).
    Author:
    Yohann Chastagnier
    • Method Detail

      • to

        public MailSending to​(MailAddress receiverMailAddress)
        Permits to specify the receiver of the mail.
        Parameters:
        receiverMailAddress - the email of the receiver.
        Returns:
        the completed instance of MailSending.
      • to

        public MailSending to​(ReceiverMailAddressSet receiverMailAddressSet)
        Permits to specify the receiver of the mail.
        Parameters:
        receiverMailAddressSet - the emails of the receivers.
        Returns:
        the completed instance of MailSending.
      • withSubject

        public MailSending withSubject​(String subject)
        Permits to specify the subject of the mail.
        Parameters:
        subject - the subject.
        Returns:
        the completed instance of MailSending.
      • withContent

        public MailSending withContent​(String content)
        Permits to specify the HTML content as String of the mail.
        Parameters:
        content - the content as String.
        Returns:
        the completed instance of MailSending.
      • withTextContent

        public MailSending withTextContent​(String content)
        Permits to specify the text content as String of the mail. If the string content contains <html> TAG, then it will be considered as an HTML one, in all cases.
        Parameters:
        content - the content as String.
        Returns:
        the completed instance of MailSending.
      • withContent

        public MailSending withContent​(javax.mail.Multipart content)
        Permits to specify the content as Multipart of the mail.
        Parameters:
        content - the content as Multipart.
        Returns:
        the completed instance of MailSending.
      • setReplyToRequired

        public MailSending setReplyToRequired()
        Indicates that the reply to field of the mail must be set.
        Returns:
        the completed instance of MailSending.
      • oneMailPerReceiver

        public MailSending oneMailPerReceiver()
        One email sent by receiver instead of one email for all receivers.
        Returns:
        the completed instance of MailSending.
      • send

        public void send()
        Performs sending of the mail. This will be executed into a Threaded mechanism.
      • sendSynchronously

        public void sendSynchronously()
        Performs sending of the mail synchronously. So the caller wait for the end of the sending treatment before to continue its processing.