Class SendEmail

java.lang.Object
org.dlese.dpc.email.SendEmail

public class SendEmail extends Object
Handles sending emails. See Javadocs for more information.
Author:
John Weatherley
  • Constructor Details

    • SendEmail

      public SendEmail(String MAIL_TYPE, String MAIL_SERVER)
      Constructor for the SendEmail object
      Parameters:
      MAIL_TYPE - The mail type, for example 'mail.smtp.host'
      MAIL_SERVER - The mail server, for example 'localhost', 'my-mail-server'
  • Method Details

    • doSendEmail

      public void doSendEmail(String[] toAddresses, String fromAddress, String msgSubject, String msgBody) throws MessagingException
      Sends email to the given address(es).
      Parameters:
      toAddresses - To address(es)
      fromAddress - From address
      msgSubject - Email subject line
      msgBody - Email content body
      Throws:
      MessagingException - If error
    • doSend

      public boolean doSend(String[] msgTo, String msgFrom, String msgSubject, String msgBody)
      Sends email to the given address(es). Does not throw Exception if error but prints error message to System.out.
      Parameters:
      msgTo - To address(es)
      msgFrom - From address
      msgSubject - Subject
      msgBody - Message body
      Returns:
      True if successful, false otherwise
    • doSend

      public boolean doSend(String msgTo, String msgFrom, String msgSubject, String msgBody)
      Sends email to the given address. Does not throw Exception if error but prints error message to System.out.
      Parameters:
      msgTo - To address
      msgFrom - From address
      msgSubject - Subject
      msgBody - Message body
      Returns:
      True if successful, false otherwise