0

I am using ews-java-api

I need to filter the emails using alias emails.

I mean, i have a mail account a@b.com and also a alias email b@b.com for this account.

Now user can send email to b@b.com and this emails comes to index of a@b.com, Now i need to filter those emails which comes to b@b.com address

I have tried below code but not helping which filed hold alias of b@b.com

 FindItemsResults<Item> fiResults = exchangeService.findItems(WellKnownFolderName.Inbox, new ItemView(100));

PropertySet propertySet = new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.MimeContent);
        exchangeService.loadPropertiesForItems(fiResults, propertySet);


 for (Item item : fiResults) {
            String messageContent = new String(((EmailMessage) item).getMimeContent().getContent());

            System.out.println(messageContent);
        }

output is some thing like this:

"null" -> "Received: from .namprd11.prod.outlook.com 
 by .namprd11.prod.outlook.com with HTTPS via
PROD.OUTLOOK.COM; Tue, 27 Mar 2018 07:21:50 +0000
Received: from namprd11.prod.outlook.com (10.175.62.11) by
 namprd11.prod.outlook.com (10.172.70.13) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id
 15.20.609.10; Tue, 27 Mar 2018 07:21:49 +0000
Received: from CY4PR11MB1941.namprd11.prod.outlook.com
 ([fe80::dcc2:abd8:21c8:9bba]) by .namprd11.prod.outlook.com
 ([fe80::dcc2:abd8:21c8:9bba%18]) with mapi id 15.20.0609.012; Tue, 27 Mar
 2018 07:21:49 +0000
From: "user, pre" <a@b.com>
To: " pre" <a@b.com>
Subject: Testing Emails with One attachment
Thread-Topic: Testing Emails with One attachment
Thread-Index: AQHTxZxElAIQ6TfnUU+t50OSMcm/SQ==
Date: Tue, 27 Mar 2018 07:21:49 +0000
Me"

IN above output to and from showing a@b.com, but in actually i have send it from b@b.com and from was also b@b.com

Need help

Baba
  • 311
  • 1
  • 2
  • 12
  • I would suggest you check the PR_TRANSPORT_MESSAGE_HEADERS property with a Mapi editor like MFCMapi or OutlookSpy. The MimeContent is not always correct https://msdn.microsoft.com/en-us/library/office/hh545614(v=exchg.140).aspx . If you see the same in the PR_TRANSPORT_MESSAGE_HEADERS then the problem is at send as the message is being received with the Address Translated – Glen Scales Mar 28 '18 at 01:33
  • Hi @GlenScales thanks for your response, I am new to ews, so facing difficulties to figure it out, I have try with ExtendedPropertyDefinition PR_TRANSPORT_MESSAGE_HEADERS = new ExtendedPropertyDefinition(0x007D, MapiPropertyType.String); but not working. – Baba Mar 28 '18 at 16:55
  • You need to use a MAPI editor like MFCMapi to look at the properties on the Message – Glen Scales Mar 29 '18 at 00:19

0 Answers0