We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable to retrieve domain name from senders email Id

We process incoming google emails using Aspose Java Email and we are currently facing an issue with one of the email . Please find the attachment. Email display name shows the senders name with out email domain but when I use the option of “Show Original” I can see the senders domain name. What APIs need to be used to get this domain name of the sender. We are using MaimMessage.getFrom().getAddress() which is returning empty string.

Your help on this is greatly appreciated


Hi Srikanth,

Thank you for posting your inquiry.

MailMessage class reads the information of an email from its header.
Headers such as Subject, From, To, etc. from email server are used to
populate these fields in the MailMessage object. If you see in the attached screenshot, you can see that the From Header doesn’t have this value and that is why Aspose.Email doesn’t provide this information.

Sure I agree with that .

What APIs we should use to retrieve the domain name from the email. The “Show Original” shows the domain name at smtp.mailfrom=NordstromAccountsPayable@nordstrom.com.

Does Aspose has other way to get this information ?

Hi Srikanth,

You can check the message headers for any such information though it is not guarenteed that the information you want will be available there. Please run a check on MailMessage.getHeaders and check all the values for your desired information.