Class Emailer

  • Direct Known Subclasses:
    NullMailer

    public class Emailer
    extends java.lang.Object
    A class that will send emails to people.
    Author:
    Alex Kalderimis
    • Constructor Summary

      Constructors 
      Constructor Description
      Emailer​(java.util.Properties properties)
      Instantiate an emailer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void email​(java.lang.String to, java.lang.String messageKey)
      Send a message to a user.
      void email​(java.lang.String to, java.lang.String messageKey, java.lang.Object... vars)
      Send a message to a user with some data.
      void informUserOfNewSharedBag​(java.lang.String to, Profile owner, InterMineBag bag)
      Send a 'sharing list' message
      void sendFareWell​(java.lang.String address, java.lang.String xml)
      Bid a user farewell from the system.
      java.lang.String subscribeToList​(java.lang.String address)
      Subscribe a user to a mailing list.
      void welcome​(java.lang.String to)
      Welcome a user to the system.
      • Methods inherited from class java.lang.Object

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

      • Emailer

        public Emailer​(java.util.Properties properties)
        Instantiate an emailer.
        Parameters:
        properties - the configuration properties.
    • Method Detail

      • email

        public void email​(java.lang.String to,
                          java.lang.String messageKey)
                   throws javax.mail.MessagingException
        Send a message to a user.
        Parameters:
        to - The recipient
        messageKey - The key for the message.
        Throws:
        javax.mail.MessagingException - if something goes wrong.
      • email

        public void email​(java.lang.String to,
                          java.lang.String messageKey,
                          java.lang.Object... vars)
                   throws javax.mail.MessagingException
        Send a message to a user with some data.
        Parameters:
        to - The recipient.
        messageKey - The message key.
        vars - The data.
        Throws:
        javax.mail.MessagingException - If something goes wrong.
      • welcome

        public void welcome​(java.lang.String to)
                     throws javax.mail.MessagingException
        Welcome a user to the system.
        Parameters:
        to - The new user.
        Throws:
        javax.mail.MessagingException - If something goes wrong.
      • sendFareWell

        public void sendFareWell​(java.lang.String address,
                                 java.lang.String xml)
                          throws javax.mail.MessagingException
        Bid a user farewell from the system.
        Parameters:
        address - The former user.
        xml - All the user's stuff.
        Throws:
        javax.mail.MessagingException - If something goes wrong.
      • subscribeToList

        public java.lang.String subscribeToList​(java.lang.String address)
                                         throws javax.mail.MessagingException
        Subscribe a user to a mailing list.
        Parameters:
        address - The address to subscribe.
        Returns:
        The address of the mailing list.
        Throws:
        javax.mail.MessagingException - if something goes wrong.
      • informUserOfNewSharedBag

        public void informUserOfNewSharedBag​(java.lang.String to,
                                             Profile owner,
                                             InterMineBag bag)
                                      throws javax.mail.MessagingException,
                                             ObjectStoreException,
                                             java.io.UnsupportedEncodingException
        Send a 'sharing list' message
        Parameters:
        to - the address to send to
        owner - the user sharing the list
        bag - the list shared
        Throws:
        javax.mail.MessagingException - if there is a problem creating the email
        ObjectStoreException - if the bag cannot read its size
        java.io.UnsupportedEncodingException - If UTF-8 is not supported.