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>
AbstractNotify
AbstractRedirect.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, setSubjectPrefix
attachError, 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, setTo
public void init() throws javax.mail.MessagingException
init
in class AbstractRedirect
javax.mail.MessagingException
public void service(org.apache.mailet.Mail originalMail) throws javax.mail.MessagingException
service
in interface org.apache.mailet.Mailet
service
in class AbstractRedirect
originalMail
- 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.MessagingException
protected javax.mail.internet.MimeBodyPart createDSN(org.apache.mailet.Mail originalMail) throws javax.mail.MessagingException
originalMail
- javax.mail.MessagingException
protected javax.mail.internet.MimeBodyPart createAttachedOriginal(org.apache.mailet.Mail originalMail, int attachmentType) throws javax.mail.MessagingException
originalMail
- javax.mail.MessagingException
protected String getStatus(javax.mail.MessagingException me)
me
- the MessagingException of which the statusCode should be
generatedpublic String getMailetInfo()
getMailetInfo
in interface org.apache.mailet.Mailet
getMailetInfo
in class org.apache.mailet.base.GenericMailet
protected 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 attachedgetAttachmentType
in class AbstractNotify
attachment
init parameter, or
MESSAGE
if missingjavax.mail.MessagingException
protected Collection<org.apache.mailet.MailAddress> 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 org.apache.mailet.MailAddress getReversePath(org.apache.mailet.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)Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.