Class SmtpService

  • All Implemented Interfaces:
    org.osgi.service.cm.ManagedService

    public class SmtpService
    extends BaseSmtpService
    implements org.osgi.service.cm.ManagedService
    OSGi service that allows to send e-mails using javax.mail.
    • Constructor Detail

      • SmtpService

        public SmtpService()
    • Method Detail

      • updated

        public void updated​(Dictionary<String,​?> properties)
                     throws org.osgi.service.cm.ConfigurationException
        Callback from the OSGi ConfigurationAdmin on configuration changes.
        Specified by:
        updated in interface org.osgi.service.cm.ManagedService
        Parameters:
        properties - the configuration properties
        Throws:
        org.osgi.service.cm.ConfigurationException - if configuration fails
      • send

        public void send​(String to,
                         String subject,
                         String bodyText)
                  throws javax.mail.MessagingException
        Method to send a message
        Parameters:
        to - Recipient of the message
        subject - Subject of the message
        bodyText - Text body of the message (null if there should be no text part)
        Throws:
        javax.mail.MessagingException - if sending the message failed
      • send

        public void send​(String to,
                         String subject,
                         String bodyText,
                         String bodyHTML)
                  throws javax.mail.MessagingException
        Method to send a message
        Parameters:
        to - Recipient of the message
        subject - Subject of the message
        bodyText - Text body of the message (null if there should be no text part)
        bodyHTML - HTML body of the message (null if there should be no HTML part)
        Throws:
        javax.mail.MessagingException - if sending the message failed
      • send

        public void send​(String to,
                         String cc,
                         String bcc,
                         String subject,
                         String bodyText)
                  throws javax.mail.MessagingException
        Send a message to multiple recipients
        Parameters:
        to - "To:" message recipient(s), separated by commas and/or spaces
        cc - "CC:" message recipient(s), separated by commas and/or spaces
        bcc - "BCC:" message recipient(s), separated by commas and/or spaces
        subject - Subject of the message
        bodyText - Text body of the message (null if there should be no text part)
        Throws:
        javax.mail.MessagingException - if sending the message failed
      • send

        public void send​(String to,
                         String cc,
                         String bcc,
                         String subject,
                         String bodyText,
                         String bodyHTML)
                  throws javax.mail.MessagingException
        Send a message to multiple recipients
        Parameters:
        to - "To:" message recipient(s), separated by commas and/or spaces
        cc - "CC:" message recipient(s), separated by commas and/or spaces
        bcc - "BCC:" message recipient(s), separated by commas and/or spaces
        subject - Subject of the message
        bodyText - Text body of the message (null if there should be no text part)
        bodyHTML - HTML body of the message (null if there should be no HTML part)
        Throws:
        javax.mail.MessagingException - if sending the message failed
      • send

        public void send​(String[] to,
                         String[] cc,
                         String[] bcc,
                         String subject,
                         String bodyText)
                  throws javax.mail.MessagingException
        Send a message to multiple recipients
        Parameters:
        to - Array with the "To:" recipients of the message
        cc - Array with the "CC:" recipients of the message
        bcc - Array with the "BCC:" recipients of the message
        subject - Subject of the message
        bodyText - Text body of the message (null if there should be no text part)
        Throws:
        javax.mail.MessagingException - if sending the message failed
      • send

        public void send​(String[] to,
                         String[] cc,
                         String[] bcc,
                         String subject,
                         String bodyText,
                         String bodyHTML)
                  throws javax.mail.MessagingException
        Send a message to multiple recipients
        Parameters:
        to - Array with the "To:" recipients of the message
        cc - Array with the "CC:" recipients of the message
        bcc - Array with the "BCC:" recipients of the message
        subject - Subject of the message
        bodyText - Text body of the message (null if there should be no text part)
        bodyHTML - HTML body of the message (null if there should be no HTML part)
        Throws:
        javax.mail.MessagingException - if sending the message failed
        IllegalArgumentException - if both bodyText and bodyHTML are null