|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Defines a set of methods that a mailet or matcher uses to communicate with its mailet container, for example, to send a new message, to deliver a message locally, or write to a log file. The MailetContext object is contained within the MailetConfig and MatcherConfig objects, which the mailet container provides the mailets and matchers when they are initialized.
Method Summary | |
void |
bounce(Mail mail,
java.lang.String message)
Bounces the message using a stanard format with the given message. |
void |
bounce(Mail mail,
java.lang.String message,
java.lang.String bouncer)
Bounces the email message using the provided email address as the sender of the bounce. |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the mailet container attribute with the given name, or null if there is no attribute by that name. |
java.util.Iterator |
getAttributeNames()
Returns an Iterator containing the attribute names available within this mailet context. |
java.util.Collection |
getLocalUsers()
Returns a Collection of the local user accounts within this mailet context. |
java.util.Collection |
getMailServers(java.lang.String host)
Returns a Collection of Strings of hostnames or ip addresses that are specified as mail server listeners for the given hostname. |
int |
getMajorVersion()
Returns the minor version of the Mailet API that this mailet container supports. |
int |
getMinorVersion()
Returns the minor version of the Mailet API that this mailet container supports. |
MailAddress |
getPostmaster()
Returns the postmaster's address for this mailet context. |
java.lang.String |
getServerInfo()
Returns the name and version of the mailet container on which the mailet is running. |
java.util.Collection |
getServerNames()
Returns a Collection of the server names that are considered "local" by this mailet context. |
void |
log(java.lang.String message)
Writes the specified message to a mailet log file, usually an event log. |
void |
log(java.lang.String message,
java.lang.Throwable t)
Writes an explanatory message and a stack trace for a given Throwable exception to the mailet log file. |
void |
removeAttribute(java.lang.String name)
Removes the attribute with the given name from the mailet context. |
void |
sendMail(MailAddress sender,
java.util.Collection recipients,
javax.mail.internet.MimeMessage msg)
Send an outgoing message to the top of this mailet container's root queue. |
void |
sendMail(MailAddress sender,
java.util.Collection recipients,
javax.mail.internet.MimeMessage msg,
java.lang.String state)
Send an outgoing message to the top of this mailet container queue for the appropriate processor that is specified. |
void |
setAttribute(java.lang.String name,
java.lang.Object object)
Binds an object to a given attribute name in this mailet context. |
void |
storeMail(MailAddress sender,
MailAddress recipient,
javax.mail.internet.MimeMessage msg)
Stores mail into local accounts (POP3 by default, or the IMAP4 Inbox) |
Method Detail |
public void bounce(Mail mail, java.lang.String message)
mail
- - the message that is to be bounced and sender to whom to return the messagemessage
- - a descriptive message as to why the message bouncedpublic void bounce(Mail mail, java.lang.String message, java.lang.String bouncer)
mail
- - the message that is to be bounced and sender to whom to return the messagemessage
- - a descriptive message as to why the message bouncedbouncer
- - the address to give as the sender of the bounced messagepublic java.util.Collection getMailServers(java.lang.String host)
host
- - the domain name for which to find mail serverspublic MailAddress getPostmaster()
public java.lang.Object getAttribute(java.lang.String name)
The attribute is returned as a java.lang.Object or some subclass. Attribute names should follow the same convention as package names. The Java Mailet API specification reserves names matching java.*, javax.*, and sun.*
name
- - a String specifying the name of the attributepublic java.util.Iterator getAttributeNames()
public int getMajorVersion()
public int getMinorVersion()
public java.lang.String getServerInfo()
The form of the returned string is servername/versionnumber. For example, JAMES may return the string JAMES/1.2.
The mailet container may return other optional information after the primary string in parentheses, for example, JAMES/1.2 (JDK 1.3.0; Windows NT 4.0 x86).
public java.util.Collection getServerNames()
public java.util.Collection getLocalUsers()
public void log(java.lang.String message)
msg
- - a String specifying the message to be written to the log filepublic void log(java.lang.String message, java.lang.Throwable t)
message
- - a String that describes the error or exceptionthrowable
- - the Throwable error or exceptionpublic void removeAttribute(java.lang.String name)
name
- - a String specifying the name of the attribute to be removedpublic void sendMail(MailAddress sender, java.util.Collection recipients, javax.mail.internet.MimeMessage msg) throws javax.mail.MessagingException
sender
- - the sender of the messagerecipients
- - a Collection of String objects of recipientsmsg
- - the MimeMessage of the headers and body content of the outgoing messagepublic void sendMail(MailAddress sender, java.util.Collection recipients, javax.mail.internet.MimeMessage msg, java.lang.String state) throws javax.mail.MessagingException
sender
- - the sender of the messagerecipients
- - a Collection of String objects of recipientsmsg
- - the MimeMessage of the headers and body content of the outgoing messagestate
- - the state of the message, indicates which processor to usepublic void setAttribute(java.lang.String name, java.lang.Object object)
Attribute names should follow the same convention as package names. The Java Mailet API specification reserves names matching java.*, javax.*, and sun.*.
name
- - a String specifying the name of the attributeobject
- - an Object representing the attribute to be boundpublic void storeMail(MailAddress sender, MailAddress recipient, javax.mail.internet.MimeMessage msg) throws javax.mail.MessagingException
sender
- - the sender of the incoming messagerecipient
- - the user who is receiving this message (as a complete email address)msg
- - the MimeMessage to store in a local mailbox
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |