jakartaee / jakartaee/mail-api

Optional of update messageId and sentDate

Open
#583 2 comments 0 reactions 1 assignee Claimed by @jmehrens View on GitHub
Dominant language
Java
Stars
285
Forks
109
Avg merge
15h 19m
Merged PRs (30d)
1

Description

If where is no messageId, and sentDate when saveChanges() called, MimeMessage always generate new messageId and set sentDate if it is not exist.

This is confusing, as when changed only one header like "Message-ID" it will be rewritten on saveChanges() call. This can broke data consistency.

Is it possible save only updated values? Or make set those headers (Message-ID, Date) optionally updatable?

```java
protected synchronized void updateHeaders() throws MessagingException {
MimeBodyPart.updateHeaders(this);
setHeader("MIME-Version", "1.0");
if (getHeader("Date") == null)
setSentDate(new Date());
updateMessageID();

if (cachedContent != null) {
dh = new DataHandler(cachedContent, getContentType());
cachedContent = null;
content = null;
if (contentStream != null) {
try {
contentStream.close();
} catch (IOException ioex) { } // nothing to do
}
contentStream = null;
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.