dcsimg

How do I get the value of a specific header, delivered-to, and the list of all headers present?

Dieter Wimberger

The javax.mail.MimeMessage API doc shows you how to achieve this:

  1. String[] delto=msg.getHeader("delivered-to");
    The array will contain all present values as Strings.
  2. Enumeration enum=msg.getAllHeaders();
    The enumeration will contain all present headers as javax.mail.Header objects.