Class MailServerImpl

  • All Implemented Interfaces:
    MailServer

    public class MailServerImpl
    extends Object
    implements MailServer
    Default MailServer implementation that sends email via the configured SMTP server.
    • Constructor Detail

      • MailServerImpl

        public MailServerImpl​(String realm)
        Default Constructor
        Parameters:
        realm - in which emails service shall be created
      • MailServerImpl

        public MailServerImpl​(ServiceConfigManager mgr,
                              ServiceConfig scm,
                              Debug debug,
                              AMSendMail sendMail,
                              Map<String,​Set<String>> options)
        Constructor used for testing
        Parameters:
        mgr - Service Configuration Manager
        scm - Service Configuration of the email service
        debug - Debug instance to provide useful debugging information
        sendMail - AMSendmail instance needed for testing
        options - SMTP Options
    • Method Detail

      • getSubject

        public String getSubject()
      • getMessage

        public String getMessage()
      • sendHtmlEmail

        public void sendHtmlEmail​(String to,
                                  String subject,
                                  String message)
                           throws jakarta.mail.MessagingException
        Description copied from interface: MailServer
        Sends an email message, containing HTML, using default MailServer settings.
        Specified by:
        sendHtmlEmail in interface MailServer
        Parameters:
        to - The address that the E-mail message is sent.
        subject - The E-mail subject.
        message - The content contained in the E-mail message.
        Throws:
        jakarta.mail.MessagingException - in the case where the module was unable to send the e-mail.
      • sendHtmlEmail

        public void sendHtmlEmail​(String from,
                                  String to,
                                  String subject,
                                  String message,
                                  Map<String,​Set<String>> options)
                           throws jakarta.mail.MessagingException
        Description copied from interface: MailServer
        Sends an email message, containing HTML, using specified options given for the MailServer settings.
        Specified by:
        sendHtmlEmail in interface MailServer
        Parameters:
        from - The address that sends the E-mail message.
        to - The address that the E-mail message is sent.
        subject - The E-mail subject.
        message - The content contained in the E-mail message.
        options - SMTPHostName, SMTPPort, SMTPUser, SMTPUserPassword.
        Throws:
        jakarta.mail.MessagingException - in case where the module was unable to send the e-mail.
      • sendEmail

        public void sendEmail​(String to,
                              String subject,
                              String message,
                              String mimeType)
                       throws jakarta.mail.MessagingException
        Description copied from interface: MailServer
        Sends an email message using default MailServer settings.
        Specified by:
        sendEmail in interface MailServer
        Parameters:
        to - the address that the email message is sent
        subject - the E-mail subject
        message - the content contained in the email message
        mimeType - the mime type to be used for the email
        Throws:
        jakarta.mail.MessagingException - in the case where the module was unable to send the email
      • sendEmail

        public void sendEmail​(String to,
                              String subject,
                              String message)
                       throws jakarta.mail.MessagingException
        Description copied from interface: MailServer
        Sends an email message using default MailServer settings
        Specified by:
        sendEmail in interface MailServer
        Parameters:
        to - The address that the E-mail message is sent
        subject - The E-mail subject
        message - The content contained in the E-mail message
        Throws:
        jakarta.mail.MessagingException - in the case where the module was unable to send the e-mail
      • sendEmail

        public void sendEmail​(String from,
                              String to,
                              String subject,
                              String message,
                              Map<String,​Set<String>> options)
                       throws jakarta.mail.MessagingException
        Description copied from interface: MailServer
        Sends an email message using specified options given for the MailServer settings
        Specified by:
        sendEmail in interface MailServer
        Parameters:
        from - The address that sends the E-mail message
        to - The address that the E-mail message is sent
        subject - The E-mail subject
        message - The content contained in the E-mail message
        options - SMTPHostName, SMTPPort, SMTPUser, SMTPUserPassword
        Throws:
        jakarta.mail.MessagingException - in case where the module was unable to send the e-mail