com.sibvisions.util
Class Mail

java.lang.Object
  extended by javax.mail.Authenticator
      extended by com.sibvisions.util.Mail

public final class Mail
extends Authenticator

The Mail class is a utility class for sending mails.


Constructor Summary
Mail(String pHost, String pSmtpPort)
          Creates a new instance of Mail with a specific mailserver and smtp port.
Mail(String pHost, String pSmtpPort, String pUserName, String pPassword)
          Creates a new instance of Mail with a specific mailserver, smtp port and authentication credentials.
 
Method Summary
protected  PasswordAuthentication getPasswordAuthentication()
          
 void send(String pFrom, String pTo, String pCc, String pSubject, String pText)
          Sends a plain text mail.
 
Methods inherited from class javax.mail.Authenticator
getDefaultUserName, getRequestingPort, getRequestingPrompt, getRequestingProtocol, getRequestingSite
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mail

public Mail(String pHost,
            String pSmtpPort)
Creates a new instance of Mail with a specific mailserver and smtp port.

Parameters:
pHost - the hostname or ip address of the mailserver
pSmtpPort - the smtp port of the mailserver

Mail

public Mail(String pHost,
            String pSmtpPort,
            String pUserName,
            String pPassword)
Creates a new instance of Mail with a specific mailserver, smtp port and authentication credentials.

Parameters:
pHost - the hostname or ip address of the mailserver
pSmtpPort - the smtp port of the mailserver
pUserName - the username for smtp authentication
pPassword - the password for smtp authentication
Method Detail

getPasswordAuthentication

protected PasswordAuthentication getPasswordAuthentication()

Overrides:
getPasswordAuthentication in class Authenticator

send

public void send(String pFrom,
                 String pTo,
                 String pCc,
                 String pSubject,
                 String pText)
          throws Exception
Sends a plain text mail.

Parameters:
pFrom - the sender
pTo - the recipient(s) comma separated
pCc - the carbon copy recipient(s) comma separated
pSubject - the subject of the message
pText - the text of the message
Throws:
Exception - if the send operation failed


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.