Package org.bluezoo.gumdrop.mime.rfc5322
Interface MessageHandler
- All Superinterfaces:
MIMEHandler
- All Known Implementing Classes:
DMARCMessageHandler
Receive notification of the logical content of an RFC 5322 email message.
This interface extends MIMEHandler to add email-specific callbacks for
structured headers defined in RFC 5322.
In addition to the MIME-level events from MIMEHandler, this interface provides callbacks for:
- Unstructured headers (Subject, Comments, etc.)
- Date headers (Date, Resent-Date)
- Address headers (From, To, Cc, Bcc, etc.)
- Message-ID headers (Message-ID, References, In-Reply-To)
- Obsolete syntax detection
- Author:
- Chris Burdess
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddressHeader(String name, List<EmailAddress> addresses) Receive notification of an address header in the message.voiddateHeader(String name, OffsetDateTime date) Receive notification of a date header in the message.voidReceive notification of an unstructured header in the message.voidmessageIDHeader(String name, List<ContentID> contentIDs) Receive notification of a message-id header in the message.voidReceive notification of an obsolete but recoverable message structure.voidunexpectedHeader(String name, String value) Receive notification of a structured header field for which the value was unparseable.Methods inherited from interface org.bluezoo.gumdrop.mime.MIMEHandler
bodyContent, contentDescription, contentDisposition, contentID, contentTransferEncoding, contentType, endEntity, endHeaders, mimeVersion, setLocator, startEntity, unexpectedContent
-
Method Details
-
header
Receive notification of an unstructured header in the message. Headers are fields that occur at the beginning of a message or body part. They contain a name and an optional value.Header values may be continued over multiple lines in the underlying message data. The value supplied here is the logical value of the header after any line unfolding and decoding of non-ASCII characters performed according to RFC 2047.
- Parameters:
name- the name of the header (field-name, cannot be null)value- the header value (field-body, may be null)- Throws:
MIMEParseException- if the processor encountered a fatal condition during parsing and wishes to cancel the parse process
-
unexpectedHeader
Receive notification of a structured header field for which the value was unparseable. This indicates a malformed message, but handlers may choose to log or ignore these events instead of throwing an exception.- Parameters:
name- the name of the header (field-name, cannot be null)value- the header value (field-body, may be null)- Throws:
MIMEParseException- if the processor encountered a fatal condition during parsing and wishes to cancel the parse process
-
dateHeader
Receive notification of a date header in the message.- Parameters:
name- the name of the header field, e.g. "Date"date- the parsed date value of the header with timezone preserved- Throws:
MIMEParseException- if the processor encountered a fatal condition during parsing and wishes to cancel the parse process
-
addressHeader
Receive notification of an address header in the message. Some header fields (e.g. From, Sender) will only have one address. Others (To, Cc, Bcc) may have multiple addresses. The addresses list will never be empty. If the value in the underlying message did not contain valid addresses it will be reported via unexpectedHeader.- Parameters:
name- the name of the header field, e.g. "From", "To"addresses- a non-empty list of parsed email addresses- Throws:
MIMEParseException- if the processor encountered a fatal condition during parsing and wishes to cancel the parse process
-
messageIDHeader
Receive notification of a message-id header in the message. Some header fields (e.g. Message-ID) will only have one ID. Others (References, In-Reply-To) may have multiple IDs. The contentIDs list will never be empty. If the value in the underlying message did not contain valid message-ids it will be reported via unexpectedHeader.- Parameters:
name- the name of the header field, e.g. "Message-ID", "References"contentIDs- the parsed message-id values (same structure as Content-ID)- Throws:
MIMEParseException- if the processor encountered a fatal condition during parsing and wishes to cancel the parse process
-
obsoleteStructure
Receive notification of an obsolete but recoverable message structure. This method will be called before the corresponding normal parsing event to allow handlers to gather statistics on obsolete structures while still processing the message content normally.- Parameters:
type- the type of obsolete structure detected- Throws:
MIMEParseException- if the processor encountered a fatal condition during parsing and wishes to cancel the parse process
-