|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.sasl.common.communication.mail.SimpleMailChannel
public class SimpleMailChannel
The class implements a simple e-Mail communication channel, for which the
sender and receivers are hard wired during creation of the channel. The input
of the sendOverChannel
method will
be converted to a MIME message and delivered to the receivers via a SMTP
server.
The setter methods of the class should not be called in a multi threading
way, otherwise the behavior of the sendOverChannel
method gets undefined.
Default property values:
smtpHostname = localhost
smtpPort = 25
smtpUser = null (no authentication required)
smtpPassword = null (no authentication required)
mimeType = text/plain
Constructor Summary | |
---|---|
SimpleMailChannel()
Default constructor, does nothing actually. |
Method Summary | |
---|---|
String |
getMimeType()
Returns the mime type of the e-Mail messages which will be send over this object. |
List<javax.mail.internet.InternetAddress> |
getReceiverAddressList()
Returns a list of receiver addresses to which e-Mail messages should be delivered which were send over this object. |
javax.mail.internet.InternetAddress |
getSenderAddress()
Returns the sender address which sends e-Mail messages over this object (From-part of an e-Mail message). |
String |
getSmtpHostname()
Returns the SMTP server hostname which should deliver e-Mail messages, which will be sended over this object. |
String |
getSmtpPassword()
Returns the password of the SMTP user which will be used to authenticate the SMTP user at the SMTP server, if authentication is required for sending e-Mail messages. |
int |
getSmtpPort()
Returns the port over which the SMTP server accepts incoming e-Mail messages. |
String |
getSmtpUser()
Returns the name of the SMTP user which will be used to authenticate at the SMTP server, if authentication is required. |
void |
sendOverChannel(String subject,
String message)
Tries to send an e-Mail message with subject "subject" and e-Mail message "message" to the configured list of receiver addresses over the setted SMTP server "synchronously" (=call blocks until the SMTP server sends an answer). |
void |
setMimeType(String mimeType)
Sets the mime type of the e-Mail messages which will be send over this object. |
void |
setReceiverAddressList(List<javax.mail.internet.InternetAddress> receiverAddressList)
Sets a list of receiver addresses to which e-Mail messages should be delivered which were send over this object. |
void |
setSenderAddress(javax.mail.internet.InternetAddress senderAddress)
Sets the sender address which sends e-Mail messages over this object (From-part of an e-Mail message). |
void |
setSmtpHostname(String smtpHostname)
Sets the SMTP server hostname which should deliver e-Mail messages, which will be sended over this object. |
void |
setSmtpPassword(String smtpPassword)
Sets the password of the SMTP user which will be used to authenticate the SMTP user at the SMTP server, if authentication is required for sending e-Mail messages. |
void |
setSmtpPort(int smtpPort)
Sets the port over which the SMTP server accepts incoming e-Mail messages. |
void |
setSmtpUser(String smtpUser)
Sets the name of the SMTP user which will be used to authenticate at the SMTP server, if authentication is required. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleMailChannel()
Method Detail |
---|
public String getSmtpHostname()
public void setSmtpHostname(String smtpHostname) throws IllegalArgumentException
smtpHost
-
IllegalArgumentException
- if smtpHostname is empty.public int getSmtpPort()
public void setSmtpPort(int smtpPort) throws IllegalArgumentException
smtpPort
- integer value greater than 0.
IllegalArgumentException
- if smtpPort is lesser than 1.public String getSmtpUser()
public void setSmtpUser(String smtpUser)
smtpUser
- null or non nullpublic String getSmtpPassword()
public void setSmtpPassword(String smtpPassword)
smtpPassword
- null or non null stringpublic String getMimeType()
public void setMimeType(String mimeType) throws IllegalArgumentException
mimeType
- non empty string
IllegalArgumentException
- if mimeType is empty.public javax.mail.internet.InternetAddress getSenderAddress()
public void setSenderAddress(javax.mail.internet.InternetAddress senderAddress)
sender
- null or non nullpublic List<javax.mail.internet.InternetAddress> getReceiverAddressList()
public void setReceiverAddressList(List<javax.mail.internet.InternetAddress> receiverAddressList) throws IllegalArgumentException
receiverList
- non null list
IllegalArgumentException
- if receiverList is empty.public void sendOverChannel(String subject, String message) throws IllegalArgumentException, CommunicationChannelException
InternetAddress.getLocalAddress(Session)
will
be used as the sender address. In all cases where no special javax.mail
property files are configured the return value from that procedure will
be: user.name AT default hostname.
sendOverChannel
in interface ICommunicationChannel
subject
- non null subject of the message.message
- non null message.
IllegalArgumentException
- if subject or message are null
CommunicationChannelException
- if an error occured by trying to send the e-Mail message to
the SMTP server.ICommunicationChannel.sendOverChannel(java.lang.String,
java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |