You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Email implements Serializable, but its current serialized form deliberately omits three pieces of state that are needed to use the restored email:
attachment, embedded-image and decrypted-attachment DataSource content;
the forwarded MimeMessage;
SmimeSigningConfig.
The result is a partial read-back. Attachment metadata may still be present, but content access or sending eventually fails because the nested data source is gone. The website documents this as a list of transient fields, including one field that no longer exists, rather than defining what serialization is useful for.
Chosen behavior for v9.2.0
Treat Java serialization as a send-ready email snapshot:
Materialize every attachment-like data source while the email is serialized.
Store its bytes, name, MIME type and Jakarta Mail EncodingAware hint.
Restore a private, read-only, byte-backed data source.
Store a forwarded message as RFC822/MIME bytes and reconstruct it with a neutral Session.
Serialize S/MIME signing configuration, including its PKCS12 data and key settings.
This preserves the email state needed to copy, govern, validate, convert and send it later. It does not preserve the original runtime object graph.
A custom DataSource is always materialized, even when that implementation also implements Serializable. After deserialization, its concrete type, lazy IMAP/URL access, caching, write behavior and implementation-specific methods are not restored. A lazy source is therefore fetched at serialization time.
Legacy streams
Simple Java Mail releases before 9.2.0 never wrote attachment bytes into the stream, so those bytes cannot be recovered later.
A pre-9.2 email should continue to deserialize for archival and metadata inspection. Its legacy attachment receives an unavailable-data placeholder. Reading or writing its content—and therefore attempting to send it—must fail with a clear exception explaining that the legacy stream contains no attachment data, instead of failing with a null pointer.
Forwarded MIME content and S/MIME signing configuration omitted by an old stream remain null; there is no data from which to reconstruct them.
Historical lineage
Enhancement: make Email serializable #218 introduced native Email serialization for queueing and later processing, while explicitly recognizing that arbitrary attachment data sources could not simply be serialized.
Problem
EmailimplementsSerializable, but its current serialized form deliberately omits three pieces of state that are needed to use the restored email:DataSourcecontent;MimeMessage;SmimeSigningConfig.The result is a partial read-back. Attachment metadata may still be present, but content access or sending eventually fails because the nested data source is gone. The website documents this as a list of transient fields, including one field that no longer exists, rather than defining what serialization is useful for.
Chosen behavior for v9.2.0
Treat Java serialization as a send-ready email snapshot:
EncodingAwarehint.This preserves the email state needed to copy, govern, validate, convert and send it later. It does not preserve the original runtime object graph.
A custom
DataSourceis always materialized, even when that implementation also implementsSerializable. After deserialization, its concrete type, lazy IMAP/URL access, caching, write behavior and implementation-specific methods are not restored. A lazy source is therefore fetched at serialization time.Legacy streams
Simple Java Mail releases before 9.2.0 never wrote attachment bytes into the stream, so those bytes cannot be recovered later.
A pre-9.2 email should continue to deserialize for archival and metadata inspection. Its legacy attachment receives an unavailable-data placeholder. Reading or writing its content—and therefore attempting to send it—must fail with a clear exception explaining that the legacy stream contains no attachment data, instead of failing with a null pointer.
Forwarded MIME content and S/MIME signing configuration omitted by an old stream remain
null; there is no data from which to reconstruct them.Historical lineage
Emailserialization for queueing and later processing, while explicitly recognizing that arbitrary attachment data sources could not simply be serialized.EncodingAwarebecause it can prevent repeated remote reads..sjmrepresentation; Generating an EML from an Email object with nested attachments, when created from an Outlook MSG file #315 later replaced that path with ordinary EML attachments.Acceptance criteria