• Post Reply Bookmark Topic Watch Topic
  • New Topic

Javamail - Identify Delivery Receipts via headers  RSS feed

 
Corrie L Sherone
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Hope this the right place for this question...)

I'm having a major brain glitch ... I've been reading about how to identify email messages that are delivery receipts. The specs say delivery receipts have a content type of


ie A mime-type plus a parameter (if that is the right term). So I loaded a sample MimeMessage and checked the content-type using MimeMessage.getContentType() , but the header also includes a dynamic "boundary" value.



So I obviously can't do a straight string comparison. So how do you verify the message has the right content-type? I know I could split the string on ";" and examine each piece, but that seems ... wrong/hackish. I thought of using MimeMessage.isMimeType() but I think that would ignore the "report-type=..." parameter.

Any suggestions would be appreciated
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree that splitting seems hackish. Using something like String.contains("report-type=delivery-status") would feel more natural.
 
Corrie L Sherone
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I like that better than splitting. Using combined with should do the trick, thanks.

(I just wanted to make sure I was not overlooking some obvious way of handling headers with parameters.)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!