Module jakarta.mail

Class InternetHeaders

java.lang.Object
jakarta.mail.internet.InternetHeaders

public class InternetHeaders extends Object
InternetHeaders is a utility class that manages RFC822 style headers. Given an RFC822 format message stream, it reads lines until the blank line that indicates end of header. The input stream is positioned at the start of the body. The lines are stored within the object and can be extracted as either Strings or Header objects.

This class is mostly intended for service providers. MimeMessage and MimeBody use this class for holding their headers.


A note on RFC822 and MIME headers

RFC822 and MIME header fields must contain only US-ASCII characters. If a header contains non US-ASCII characters, it must be encoded as per the rules in RFC 2047. The MimeUtility class provided in this package can be used to to achieve this. Callers of the setHeader, addHeader, and addHeaderLine methods are responsible for enforcing the MIME requirements for the specified headers. In addition, these header fields must be folded (wrapped) before being sent if they exceed the line length limitation for the transport (1000 bytes for SMTP). Received headers may have been folded. The application is responsible for folding and unfolding headers as appropriate.

The current implementation supports the System property mail.mime.ignorewhitespacelines, which if set to true will cause a line containing only whitespace to be considered a blank line terminating the header.

See Also: