org.hackystat.sensorbase.mailer
Class Mailer

java.lang.Object
  extended by org.hackystat.sensorbase.mailer.Mailer

public class Mailer
extends java.lang.Object

Provides a wrapper for SensorBase email services. Use the singleton instance to send emails: Mailer.getInstance().send(). To aid in testing, no emails are sent if the Hackystat server is a test installation, or the user email is in hackystat test domain.

Author:
Philip M. Johnson

Method Summary
static Mailer getInstance()
          Returns the singleton instance of Mailer, creating it if necesssary.
 boolean send(java.lang.String toAddr, java.lang.String subject, java.lang.String body)
          Attempts to send an email.
 boolean send(java.lang.String fromAddr, java.lang.String toAddr, java.lang.String subject, java.lang.String body)
          Attempts to send an email.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Mailer getInstance()
Returns the singleton instance of Mailer, creating it if necesssary.

Returns:
The singleton Mailer instance.

send

public boolean send(java.lang.String fromAddr,
                    java.lang.String toAddr,
                    java.lang.String subject,
                    java.lang.String body)
Attempts to send an email. To aid in testing, no emails are sent if the Hackystat server is a test installation, or the user email is in hackystat test domain. Returns false if the send fails.

Parameters:
fromAddr - The email address from
toAddr - The email address to send to.
subject - The subject of the email.
body - The email body.
Returns:
True if no error occurred during send, false otherwise

send

public boolean send(java.lang.String toAddr,
                    java.lang.String subject,
                    java.lang.String body)
Attempts to send an email. To aid in testing, no emails are sent if the Hackystat server is a test installation, or the user email is in hackystat test domain. Returns false if the send fails.

Parameters:
toAddr - The email address to send to.
subject - The subject of the email.
body - The email body.
Returns:
True if no error occurred during send, false otherwise