How do I get the sender of an email?

John Zukowski

The getFrom() of Message is one way, but the getSender() method of MimeMessage reads the RFC 822 Sender header field. A value of null is returned if the header isn't present. Comparing the two allows you to see if someone is lying. :-)