mail-api icon indicating copy to clipboard operation
mail-api copied to clipboard

Allow adding/removing multiple headers in one method call

Open glassfishrobot opened this issue 7 years ago • 2 comments

It would be nice to have convenience methods to add and remove multiple headers in InternetHeaders and subsequently MimeMessage and MimeBodyPart.

These could include:

addHeader(Header header)
addHeadersWithHeaderList(List<Header> headers)
addHeadersWithStringList(List<String> headers)
setHeader(Header header)
removeHeader(Header header)
removeHeadersWithHeaderList(List<Header> headers)
removeHeadersWithStringList(List<String> headers)

glassfishrobot avatar Dec 27 '17 19:12 glassfishrobot

  • Issue Imported From: https://github.com/javaee/javamail/issues/298
  • Original Issue Raised By:@jhult
  • Original Issue Assigned To: Unassigned

glassfishrobot avatar Sep 10 '18 06:09 glassfishrobot

@bshannon Commented This would be a change to the public JavaMail API, which normally requires going through the JCP. This will be considered for JavaMail 1.7.

I'm not sure addHeadersWithStringList(List<String> headers) makes any sense since there would be no header values.

Likewise, I'm not sure removeHeadersWithHeaderList(List<Header> headers) and removeHeader(Header header) makes any sense since the header values wouldn't be used, unless you expected it to match the header values as well. (Is there really a use case for that?)

glassfishrobot avatar Jan 10 '18 23:01 glassfishrobot