public interface EmailExaminer
javax.mail.Message
objects. It's designed to
get information about bounced emails in particular via information
found in the body or headers of the email. Each particular MTA provides
information about the nature of the bounced email in their own format, and
thus it is expected that an implementation of an EmailExaminer should
be created for each specific MTA that the user is expecting to receive
bounced emails from.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
examineEmail(javax.mail.Message pMessage)
This is a generic method that can be used to examine a message
in an implementation-specific manner and in a context that is
meaningful to the developer implementing it.
|
java.lang.String |
getBouncedEmailAddress(javax.mail.Message pMessage)
Gets the email address of the bounced recipient from the
given
javax.mail.Message . |
java.lang.String |
getBouncedEnhancedStatusCode(javax.mail.Message pMessage)
Gets the enhanced status code from the given bounced email.
|
java.lang.String |
getBouncedErrorMessage(javax.mail.Message pMessage)
Gets the error message from the given bounced email.
|
java.lang.String |
getBouncedReplyCode(javax.mail.Message pMessage)
Gets the reply code (RFC 821) of the given bounced message.
|
java.lang.String[] |
getMonitoredBounceReplyCodes()
Gets the reply codes that indicate an email is bounced
|
java.lang.String |
getMTAName()
Gets the name of the MTA that this examiner is valid for
For example, if this returns the value "sendmail", then the
user can assume that this examiner will correctly get information from
bounced emails in a sendmail-based format
|
boolean |
isBouncedEmail(javax.mail.Message pMessage)
Checks the passed in
javax.mail.Message object
for indications that it has been bounced. |
void |
setMonitoredBounceReplyCodes(java.lang.String[] pReplyCodes)
Sets the reply codes that indicate an email is bounced
This can be any number of standard SMTP codes defined in
RFC 821.
|
static final java.lang.String CLASS_VERSION
java.lang.String getMTAName()
void setMonitoredBounceReplyCodes(java.lang.String[] pReplyCodes)
pReplyCodes
- an array of RFC 821 reply codes that,
if present, will indicate a message has been bouncedjava.lang.String[] getMonitoredBounceReplyCodes()
boolean isBouncedEmail(javax.mail.Message pMessage) throws javax.mail.MessagingException, EmailException
javax.mail.Message
object
for indications that it has been bounced. Each MTA sends
a formatted reply for bounced emails, so this implementation
will depend on the specific MTA examiner used.pMessage
- the message to examinejavax.mail.MessagingException
- if a problem occurs while calling
methods on the pMessage
objectEmailException
- if a problem occurs during the parsing
of the content, of invalid arguments are specified
NOTE: An exception should NOT be thrown if the given message
is not in a format recognized by this examiner. In most cases,
a list of examiners will be called upon to see if any consider
the message as bounced in a given operation. Developers are
expected to return false in this case.java.lang.String getBouncedEmailAddress(javax.mail.Message pMessage) throws javax.mail.MessagingException, EmailException
javax.mail.Message
. This address can
be found via MTA-specific headers, or body content and is
implementation dependent. If the passed in message has not
been found to be bounced, this should return null.pMessage
- the bounced message to examinepMessage
i.e. the formatting is not what was expected, or the message
has not been determined as bouncedjavax.mail.MessagingException
- if a problem occurs while calling
methods on the pMessage
objectEmailException
- if a problem occurs during the parsing
of the content, of invalid arguments are specified
NOTE: An exception should NOT be thrown if the given message
is not in a format recognized by this examiner. In most cases,
a list of examiners will be called upon to see if any consider
the message as bounced in a given operation. Developers are
expected to return null in this case.java.lang.String getBouncedErrorMessage(javax.mail.Message pMessage) throws javax.mail.MessagingException, EmailException
pMessage
should also
be declared as bounced before looking for the error message, otherwise
null should be returnedpMessage
- the bounced message to examinepMessage
i.e. the formatting is not what was
expected, or the message has not been determined as bouncedjavax.mail.MessagingException
- if a problem occurs while calling
methods on the pMessage
objectEmailException
- if a problem occurs during the parsing
of the content, of invalid arguments are specified
NOTE: An exception should NOT be thrown if the given message
is not in a format recognized by this examiner. In most cases,
a list of examiners will be called upon to see if any consider
the message as bounced in a given operation. Developers are expected
to return null in this case.java.lang.String getBouncedEnhancedStatusCode(javax.mail.Message pMessage) throws javax.mail.MessagingException, EmailException
pMessage
should also be declared as
bounced before looking for the status code, otherwise null should
be returned.pMessage
- the bounced message to examinepMessage
i.e. the formatting is not what was
expected, or the message has not been determined as bouncedjavax.mail.MessagingException
- if a problem occurs while calling
methods on the pMessage
objectEmailException
- if a problem occurs during the parsing
of the content, of invalid arguments are specified
NOTE: An exception should NOT be thrown if the given message
is not in a format recognized by this examiner. In most cases,
a list of examiners will be called upon to see if any consider
the message as bounced in a given operation. Developers are expected
to return null in this case.java.lang.String getBouncedReplyCode(javax.mail.Message pMessage) throws javax.mail.MessagingException, EmailException
getMonitoredReplyCodes
array. The location of this code is MTA-specific and is the
developers responsibility to determine its location in a given
message. The passed in pMessage
should also be
declared as bounced before looking for the reply code, otherwise
null should be returnedpMessage
- the bounced message to examinepMessage
i.e. the formatting is not what was
expected, or the message has not been determined as bouncedjavax.mail.MessagingException
- if a problem occurs while calling
methods on the pMessage
objectEmailException
- if a problem occurs during the parsing
of the content, of invalid arguments are specified
NOTE: An exception should NOT be thrown if the given message
is not in a format recognized by this examiner. In most cases,
a list of examiners will be called upon to see if any consider
the message as bounced in a given operation. Developers are expected
to return null in this case.java.lang.Object examineEmail(javax.mail.Message pMessage) throws javax.mail.MessagingException, EmailException
pMessage
- the message to examinejavax.mail.MessagingException
- if a problem occurs while calling methods
on the pMessage
objectEmailException
- if a problem occurs during the parsing
of the content, of invalid arguments are specified