Search code examples
javaemailjakarta-mailyahoo-mail

How can I go about retrieving the names associated to a particular email (YahooMail)


How can I go about retrieving the names associated to a particular email (YahooMail).

For example, in YahooMail:

Message message = messages[i];
message.getFrom()[0].toString();

gives something that looks like:

From: Company Group <[email protected]>

Instead of FirstName SecondName LastName, which I saved the person as.

The rest of the code is at: JavaMail API - Checking Emails.


Solution

  • When you say "saved the person", I assume you mean in your address book in Yahoo Mail.

    The sender of the message sets the From address, including the "personal name" field, and they have no idea what you set in your address book. You might be able to correlate the email address of the sender with an entry in your address book, but JavaMail provides no APIs to access your address book. The Yahoo Contacts API might be helpful.