public class DSNBounce extends AbstractNotify
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>
AbstractNotifyAbstractRedirect.SpecialAddress| Constructor and Description |
|---|
DSNBounce() |
| Modifier and Type | Method and Description |
|---|---|
protected javax.mail.internet.MimeBodyPart |
createAttachedOriginal(org.apache.mailet.Mail originalMail,
int attachmentType)
Create a MimeBodyPart with the original Mail as Attachment
|
protected javax.mail.internet.MimeBodyPart |
createDSN(org.apache.mailet.Mail originalMail)
creates the DSN-bodypart for automated processing
|
protected javax.mail.internet.MimeBodyPart |
createTextMsg(org.apache.mailet.Mail originalMail)
Create a MimeBodyPart with a textual description for human readers.
|
protected String[] |
getAllowedInitParameters()
Gets the expected init parameters.
|
protected int |
getAttachmentType()
Gets the
attachment property. |
String |
getMailetInfo() |
protected Collection<org.apache.mailet.MailAddress> |
getRecipients()
Gets the
recipients property. |
protected org.apache.mailet.MailAddress |
getReversePath(org.apache.mailet.Mail originalMail)
Gets the
reversePath property, built dynamically using the
original Mail object. |
protected 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
|
void |
service(org.apache.mailet.Mail originalMail)
Service does the hard work and bounces the originalMail in the format
specified by RFC3464.
|
getInLineType, getMessage, getMessage, getPassThrough, getReplyTo, getSender, getSubject, getSubjectPrefix, isReply, setSubjectPrefixattachError, attachError, buildAlteredMessage, changeSubject, getAttachmentType, getFakeDomainCheck, getFakeDomainCheck, getInLineType, getMessageHeaders, getPassThrough, getRecipients, getReplyTo, getReversePath, getSender, getSpecialAddress, getSubject, getSubjectPrefix, getTo, getTypeCode, isReply, isStatic, replaceInternetAddresses, replaceMailAddresses, senderDomainIsValid, setDNSService, setIsReply, setRecipients, setReplyTo, setReversePath, setSender, setTopublic void init()
throws javax.mail.MessagingException
init in class AbstractRedirectjavax.mail.MessagingExceptionpublic void service(org.apache.mailet.Mail originalMail)
throws javax.mail.MessagingException
service in interface org.apache.mailet.Mailetservice in class AbstractRedirectoriginalMail - the mail to bouncejavax.mail.MessagingException - if a problem arises formulating the redirected mailMailet.service(org.apache.mailet.Mail)protected javax.mail.internet.MimeBodyPart createTextMsg(org.apache.mailet.Mail originalMail)
throws javax.mail.MessagingException
originalMail - javax.mail.MessagingExceptionprotected javax.mail.internet.MimeBodyPart createDSN(org.apache.mailet.Mail originalMail)
throws javax.mail.MessagingException
originalMail - javax.mail.MessagingExceptionprotected javax.mail.internet.MimeBodyPart createAttachedOriginal(org.apache.mailet.Mail originalMail,
int attachmentType)
throws javax.mail.MessagingException
originalMail - javax.mail.MessagingExceptionprotected String getStatus(javax.mail.MessagingException me)
me - the MessagingException of which the statusCode should be
generatedpublic String getMailetInfo()
getMailetInfo in interface org.apache.mailet.MailetgetMailetInfo in class org.apache.mailet.base.GenericMailetprotected String[] getAllowedInitParameters()
getAllowedInitParameters in class AbstractRedirectprotected int getAttachmentType()
throws javax.mail.MessagingException
AbstractRedirectattachment 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 attachedgetAttachmentType in class AbstractNotifyattachment init parameter, or
MESSAGE if missingjavax.mail.MessagingExceptionprotected Collection<org.apache.mailet.MailAddress> getRecipients()
AbstractRedirectrecipients property. Returns the collection of
recipients of the new message, or null if no change is requested. Is a
"getX()" method.getRecipients in class AbstractNotifySpecialAddress.REVERSE_PATHprotected javax.mail.internet.InternetAddress[] getTo()
AbstractRedirectto property. Returns the "To:" recipients of the
new message. or null if no change is requested. Is a "getX()" method.getTo in class AbstractNotifySpecialAddress.REVERSE_PATHprotected org.apache.mailet.MailAddress getReversePath(org.apache.mailet.Mail originalMail)
AbstractRedirectreversePath property, built dynamically using the
original Mail object. Is a "getX(Mail)" method.getReversePath in class AbstractNotifySpecialAddress.NULL (the meaning of bounce)Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.