The Javamail API has a Massage class which has a getFrom() methode, as you can find here:
https://javamail.java.net/nonav/docs/api/javax/mail/Message.html#getFrom()
Two questions about this method:
In the standard RFC 5322 SMTP allows multiple FROM addresses
3.6.2. Originator Fields
The originator fields of a message consist of the from field, the sender field (when applicable), and optionally the reply-to field. The from field consists of the field name "From" and a comma-separated list of one or more mailbox specifications. If the from field contains more than one mailbox specification in the mailbox list, then the sender field, containing the field name "Sender" and a single mailbox specification, MUST appear in the message. In either case, an optional reply-to field MAY also be included, which contains the field name "Reply-To" and a comma-separated list of one or more addresses.
from = "From:" mailbox-list CRLF
Take a look at Michael Hampton's answer to this serverfault question: SMTP allows for multiple from addresses. Was this ever useful, why does this exist?
As he mentions in his answer:
RFC 822 actually gives an example of this usage. It required that the Sender: header be present when it was used.
A.2.7. Agent for member of a committee
George's secretary sends out a message which was authored jointly by all the members of a committee. Note that the name of the committee cannot be specified, since <group> names are not permitted in the From field. From: Jones@Host, Smith@Other-Host, Doe@Somewhere-Else Sender: Secy@SHost
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With