public class JamesMailetContext extends Object implements org.apache.mailet.MailetContext, LogEnabled, Configurable
Modifier and Type | Field and Description |
---|---|
protected DNSService |
dns |
protected org.slf4j.Logger |
log |
Constructor and Description |
---|
JamesMailetContext() |
Modifier and Type | Method and Description |
---|---|
void |
bounce(org.apache.mailet.Mail mail,
String message)
This generates a response to the Return-Path address, or the address of
the message's sender if the Return-Path is not available.
|
void |
bounce(org.apache.mailet.Mail mail,
String message,
org.apache.mailet.MailAddress bouncer)
This generates a response to the Return-Path address, or the address of
the message's sender if the Return-Path is not available.
|
void |
configure(org.apache.commons.configuration.HierarchicalConfiguration config)
Configure the object.
|
Object |
getAttribute(String key) |
Iterator<String> |
getAttributeNames() |
Collection<String> |
getMailServers(String host) |
int |
getMajorVersion() |
int |
getMinorVersion() |
org.apache.mailet.MailAddress |
getPostmaster() |
String |
getServerInfo() |
Iterator<org.apache.mailet.HostAddress> |
getSMTPHostAddresses(String domainName)
Performs DNS lookups as needed to find servers which should or might
support SMTP.
|
boolean |
isLocalEmail(org.apache.mailet.MailAddress mailAddress) |
boolean |
isLocalServer(String name) |
boolean |
isLocalUser(String name) |
void |
log(String arg0) |
void |
log(String arg0,
Throwable arg1) |
void |
removeAttribute(String key) |
void |
sendMail(org.apache.mailet.Mail mail)
TODO: Should we use the MailProcessorList or the MailQueue here ?
|
void |
sendMail(org.apache.mailet.MailAddress sender,
Collection recipients,
javax.mail.internet.MimeMessage message) |
void |
sendMail(org.apache.mailet.MailAddress sender,
Collection recipients,
javax.mail.internet.MimeMessage message,
String state) |
void |
sendMail(javax.mail.internet.MimeMessage message)
Place a mail on the spool for processing
|
void |
setAttribute(String key,
Object object) |
void |
setDNSService(DNSService dns) |
void |
setDomainList(DomainList domains) |
void |
setLog(org.slf4j.Logger log)
Sets the service log.
|
void |
setMailProcessor(MailProcessor processorList) |
void |
setUsersRepository(UsersRepository localusers) |
void |
storeMail(org.apache.mailet.MailAddress sender,
org.apache.mailet.MailAddress recipient,
javax.mail.internet.MimeMessage msg)
Deprecated.
since 2.2.0 look at the LocalDelivery code to find out how to
do the local delivery.
|
protected DNSService dns
protected org.slf4j.Logger log
public void setMailProcessor(MailProcessor processorList)
public void setDNSService(DNSService dns)
public void setUsersRepository(UsersRepository localusers)
public void setDomainList(DomainList domains)
public Collection<String> getMailServers(String host)
getMailServers
in interface org.apache.mailet.MailetContext
MailetContext.getMailServers(String)
public Object getAttribute(String key)
getAttribute
in interface org.apache.mailet.MailetContext
MailetContext.getAttribute(java.lang.String)
public void setAttribute(String key, Object object)
setAttribute
in interface org.apache.mailet.MailetContext
MailetContext.setAttribute(java.lang.String,
java.lang.Object)
public void removeAttribute(String key)
removeAttribute
in interface org.apache.mailet.MailetContext
MailetContext.removeAttribute(java.lang.String)
public Iterator<String> getAttributeNames()
getAttributeNames
in interface org.apache.mailet.MailetContext
MailetContext.getAttributeNames()
public void bounce(org.apache.mailet.Mail mail, String message) throws javax.mail.MessagingException
bounce
in interface org.apache.mailet.MailetContext
javax.mail.MessagingException
MailetContext.bounce(Mail, String)
public void bounce(org.apache.mailet.Mail mail, String message, org.apache.mailet.MailAddress bouncer) throws javax.mail.MessagingException
This generates a response to the Return-Path address, or the address of the message's sender if the Return-Path is not available. Note that this is different than a mail-client's reply, which would use the Reply-To or From header.
Bounced messages are attached in their entirety (headers and content) and the resulting MIME part type is "message/rfc822".
The attachment to the subject of the original message (or "No Subject" if there is no subject in the original message)
There are outstanding issues with this implementation revolving around handling of the return-path header.
MIME layout of the bounce message:
multipart (mixed)/ contentPartRoot (body) = mpContent (alternative)/ part (body) = message part (body) = original
bounce
in interface org.apache.mailet.MailetContext
javax.mail.MessagingException
MailetContext.bounce(Mail, String, MailAddress)
public boolean isLocalUser(String name)
isLocalUser
in interface org.apache.mailet.MailetContext
MailetContext.isLocalUser(String)
public boolean isLocalEmail(org.apache.mailet.MailAddress mailAddress)
isLocalEmail
in interface org.apache.mailet.MailetContext
MailetContext.isLocalEmail(org.apache.mailet.MailAddress)
public org.apache.mailet.MailAddress getPostmaster()
getPostmaster
in interface org.apache.mailet.MailetContext
MailetContext.getPostmaster()
public int getMajorVersion()
getMajorVersion
in interface org.apache.mailet.MailetContext
MailetContext.getMajorVersion()
public int getMinorVersion()
getMinorVersion
in interface org.apache.mailet.MailetContext
MailetContext.getMinorVersion()
public Iterator<org.apache.mailet.HostAddress> getSMTPHostAddresses(String domainName)
getSMTPHostAddresses
in interface org.apache.mailet.MailetContext
domainName
- - the domain for which to find mail serversDNSService.getHostName(java.net.InetAddress)
public String getServerInfo()
getServerInfo
in interface org.apache.mailet.MailetContext
MailetContext.getServerInfo()
public boolean isLocalServer(String name)
isLocalServer
in interface org.apache.mailet.MailetContext
MailetContext.isLocalServer(java.lang.String)
public void log(String arg0)
log
in interface org.apache.mailet.MailetContext
MailetContext.log(java.lang.String)
public void log(String arg0, Throwable arg1)
log
in interface org.apache.mailet.MailetContext
MailetContext.log(java.lang.String,
java.lang.Throwable)
public void sendMail(javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
sendMail
in interface org.apache.mailet.MailetContext
message
- the message to sendjavax.mail.MessagingException
- if an exception is caught while placing the mail on the spoolpublic void sendMail(org.apache.mailet.MailAddress sender, Collection recipients, javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
sendMail
in interface org.apache.mailet.MailetContext
javax.mail.MessagingException
MailetContext.sendMail(org.apache.mailet.MailAddress,
java.util.Collection, javax.mail.internet.MimeMessage)
public void sendMail(org.apache.mailet.Mail mail) throws javax.mail.MessagingException
sendMail
in interface org.apache.mailet.MailetContext
javax.mail.MessagingException
MailetContext.sendMail(org.apache.mailet.Mail)
public void sendMail(org.apache.mailet.MailAddress sender, Collection recipients, javax.mail.internet.MimeMessage message, String state) throws javax.mail.MessagingException
sendMail
in interface org.apache.mailet.MailetContext
javax.mail.MessagingException
MailetContext.sendMail(org.apache.mailet.MailAddress,
java.util.Collection, javax.mail.internet.MimeMessage, java.lang.String)
public void storeMail(org.apache.mailet.MailAddress sender, org.apache.mailet.MailAddress recipient, javax.mail.internet.MimeMessage msg) throws javax.mail.MessagingException
This method has been moved to LocalDelivery (the only client of the method). Now we can safely remove it from the Mailet API and from this implementation of MailetContext.
The local field localDeliveryMailet will be removed when we remove the storeMail method.
storeMail
in interface org.apache.mailet.MailetContext
javax.mail.MessagingException
MailetContext.storeMail(org.apache.mailet.MailAddress,
org.apache.mailet.MailAddress, javax.mail.internet.MimeMessage)
public void setLog(org.slf4j.Logger log)
LogEnabled
setLog
in interface LogEnabled
log
- not nullLogEnabled.setLog(org.slf4j.Logger)
public void configure(org.apache.commons.configuration.HierarchicalConfiguration config) throws org.apache.commons.configuration.ConfigurationException
Configurable
configure
in interface Configurable
org.apache.commons.configuration.ConfigurationException
Configurable.configure(HierarchicalConfiguration)
Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.