Class MailUtils


  • public abstract class MailUtils
    extends java.lang.Object
    Mail utilities for the webapp.
    Author:
    Kim Rutherford, Matthew Wakeling
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void email​(java.lang.String to, java.lang.String subject, java.lang.String body, java.lang.String from, java.util.Properties webProperties)
      Send an email to an address, supplying the recipient, subject and body.
      static void email​(java.lang.String to, java.lang.String subject, java.lang.String body, java.util.Properties webProperties)  
      static void emailPasswordToken​(java.lang.String to, java.lang.String url, java.util.Properties webProperties)
      Send a password change email to an email address
      static void subscribe​(java.lang.String email, java.util.Properties webProperties)
      Subscribe the given email address to the mailing list specified in the mine config file
      static void welcome​(java.lang.String to, java.util.Properties webProperties)
      Send a welcoming email to an email address
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • welcome

        public static void welcome​(java.lang.String to,
                                   java.util.Properties webProperties)
                            throws javax.mail.MessagingException
        Send a welcoming email to an email address
        Parameters:
        to - the address to send to
        webProperties - properties such as the from address
        Throws:
        javax.mail.MessagingException - if there is a problem creating the email
      • email

        public static void email​(java.lang.String to,
                                 java.lang.String subject,
                                 java.lang.String body,
                                 java.lang.String from,
                                 java.util.Properties webProperties)
                          throws javax.mail.MessagingException
        Send an email to an address, supplying the recipient, subject and body.
        Parameters:
        to - the address to send to
        subject - The Subject of the email
        body - The content of the email
        from - the address to send from
        webProperties - Common properties for all emails (such as from, authentication)
        Throws:
        javax.mail.MessagingException - if there is a problem creating the email
      • email

        public static void email​(java.lang.String to,
                                 java.lang.String subject,
                                 java.lang.String body,
                                 java.util.Properties webProperties)
                          throws javax.mail.MessagingException
        Parameters:
        to - the address to send to
        subject - The Subject of the email
        body - The content of the email
        webProperties - Common properties for all emails (such as from, authentication)
        Throws:
        javax.mail.MessagingException - if there is a problem creating the email
      • emailPasswordToken

        public static void emailPasswordToken​(java.lang.String to,
                                              java.lang.String url,
                                              java.util.Properties webProperties)
                                       throws java.lang.Exception
        Send a password change email to an email address
        Parameters:
        to - the address to send to
        url - the URL to embed in the email
        webProperties - properties such as the from address
        Throws:
        java.lang.Exception - if there is a problem creating the email
      • subscribe

        public static void subscribe​(java.lang.String email,
                                     java.util.Properties webProperties)
                              throws javax.mail.MessagingException
        Subscribe the given email address to the mailing list specified in the mine config file
        Parameters:
        email - the email to subscribe
        webProperties - the web properties
        Throws:
        javax.mail.MessagingException - when something goes wrong