|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.mailet.GenericMailet org.apache.james.transport.mailets.AbstractRedirect org.apache.james.transport.mailets.AbstractNotify org.apache.james.transport.mailets.DSNBounce
public class DSNBounce
Generates a Delivery Status Notification (DSN) 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 reverse-path and the Return-Path header of the response is set to "null" ("<>"),
meaning that no reply should be sent.
A sender of the notification message can optionally be specified.
If one is not specified, the postmaster's address will be used.
Supports the passThrough
init parameter (true if missing).
Sample configuration:
<mailet match="All" class="DSNBounce">
<sender>an address or postmaster or sender or unaltered,
default=postmaster</sender>
<prefix>optional subject prefix prepended to the original
message</prefix>
<attachment>message, heads or none, default=message</attachment>
<messageString>the message sent in the bounce, the first occurrence of the pattern [machine] is replaced with the name of the executing machine, default=Hi. This is the James mail server at [machine] ... </messageString>
<passThrough>true or false, default=true</passThrough>
<debug>true or false, default=false</debug>
</mailet>
AbstractNotify
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.james.transport.mailets.AbstractRedirect |
---|
AbstractRedirect.SpecialAddress |
Field Summary |
---|
Fields inherited from class org.apache.james.transport.mailets.AbstractRedirect |
---|
ALL, BODY, HEADS, isDebug, isStatic, MESSAGE, NONE, UNALTERED |
Constructor Summary | |
---|---|
DSNBounce()
|
Method Summary | |
---|---|
protected javax.mail.internet.MimeBodyPart |
createAttachedOriginal(Mail originalMail,
int attachmentType)
Create a MimeBodyPart with the original Mail as Attachment |
protected javax.mail.internet.MimeBodyPart |
createDSN(Mail originalMail)
creates the DSN-bodypart for automated processing |
protected javax.mail.internet.MimeBodyPart |
createTextMsg(Mail originalMail)
Create a MimeBodyPart with a textual description for human readers. |
protected java.lang.String[] |
getAllowedInitParameters()
Gets the expected init parameters. |
protected int |
getAttachmentType()
Gets the attachment property. |
protected java.lang.String |
getErrorMsg(javax.mail.MessagingException me)
Utility method for getting the error message from the (nested) exception. |
java.lang.String |
getMailetInfo()
Returns information about the mailet, such as author, version, and copyright. |
protected java.util.Collection |
getRecipients()
Gets the recipients property. |
protected MailAddress |
getReversePath(Mail originalMail)
Gets the reversePath property,
built dynamically using the original Mail object. |
protected java.lang.String |
getStatus(javax.mail.MessagingException me)
Guessing status code by the exception provided. |
protected javax.mail.internet.InternetAddress[] |
getTo()
Gets the to property. |
void |
init()
Initialize the mailet |
protected java.lang.String |
newName(Mail mail)
Create a unique new primary key name. |
void |
service(Mail originalMail)
Service does the hard work and bounces the originalMail in the format specified by RFC3464. |
Methods inherited from class org.apache.james.transport.mailets.AbstractNotify |
---|
getInLineType, getMessage, getMessage, getPassThrough, getReplyTo, getSender, getSubject, getSubjectPrefix, isReply, setSubjectPrefix |
Methods inherited from class org.apache.james.transport.mailets.AbstractRedirect |
---|
attachError, attachError, buildAlteredMessage, changeSubject, getAttachmentType, getFakeDomainCheck, getFakeDomainCheck, getInLineType, getMessageHeaders, getPassThrough, getRecipients, getReplyTo, getReversePath, getSender, getSpecialAddress, getSubject, getSubjectPrefix, getTo, getTypeCode, isReply, isStatic, replaceInternetAddresses, replaceMailAddresses, senderDomainIsValid, setIsReply, setRecipients, setReplyTo, setReversePath, setSender, setTo |
Methods inherited from class org.apache.mailet.GenericMailet |
---|
destroy, getInitParameter, getInitParameter, getInitParameterNames, getMailetConfig, getMailetContext, getMailetName, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DSNBounce()
Method Detail |
---|
public void init() throws javax.mail.MessagingException
init
in class AbstractRedirect
javax.mail.MessagingException
- if an exception occurs that interrupts the mailet's normal operationpublic void service(Mail originalMail) throws javax.mail.MessagingException
service
in interface Mailet
service
in class AbstractRedirect
originalMail
- the mail to bounce
javax.mail.MessagingException
- if a problem arises formulating the redirected mailMailet.service(org.apache.mailet.Mail)
protected javax.mail.internet.MimeBodyPart createTextMsg(Mail originalMail) throws javax.mail.MessagingException
originalMail
-
javax.mail.MessagingException
protected javax.mail.internet.MimeBodyPart createDSN(Mail originalMail) throws javax.mail.MessagingException
originalMail
-
javax.mail.MessagingException
protected javax.mail.internet.MimeBodyPart createAttachedOriginal(Mail originalMail, int attachmentType) throws javax.mail.MessagingException
originalMail
-
javax.mail.MessagingException
protected java.lang.String getStatus(javax.mail.MessagingException me)
MessagingException
-
protected java.lang.String getErrorMsg(javax.mail.MessagingException me)
MessagingException
-
protected java.lang.String newName(Mail mail) throws javax.mail.MessagingException
mail
- the mail to use as the basis for the new mail name
javax.mail.MessagingException
public java.lang.String getMailetInfo()
GenericMailet
getMailetInfo
in interface Mailet
getMailetInfo
in class GenericMailet
protected java.lang.String[] getAllowedInitParameters()
getAllowedInitParameters
in class AbstractRedirect
protected int getAttachmentType() throws javax.mail.MessagingException
AbstractRedirect
attachment
property.
May return one of the following values to indicate how to attach the original message
to the new message:
BODY
: original message body is attached as plain text to the new messageHEADS
: original message headers are attached as plain text to the new messageALL
: original is attached as plain text with all headersMESSAGE
: original message is attached as type message/rfc822, a complete mail message.NONE
: original is not attached
getAttachmentType
in class AbstractNotify
attachment
init parameter, or MESSAGE
if missing
javax.mail.MessagingException
protected java.util.Collection getRecipients()
AbstractRedirect
recipients
property.
Returns the collection of recipients of the new message,
or null if no change is requested.
Is a "getX()" method.
getRecipients
in class AbstractNotify
SpecialAddress.REVERSE_PATH
protected javax.mail.internet.InternetAddress[] getTo()
AbstractRedirect
to
property.
Returns the "To:" recipients of the new message.
or null if no change is requested.
Is a "getX()" method.
getTo
in class AbstractNotify
SpecialAddress.REVERSE_PATH
protected MailAddress getReversePath(Mail originalMail)
AbstractRedirect
reversePath
property,
built dynamically using the original Mail object.
Is a "getX(Mail)" method.
getReversePath
in class AbstractNotify
SpecialAddress.NULL
(the meaning of bounce)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |