How to Extract Sender's Timezone from Outlook Email via EWS

Product

Aspose.Email for Java with Exchange Web Services (EWS)

Question

How can I retrieve the original sender’s timezone from emails fetched from Exchange using Aspose.Email? All timestamp properties and headers are returning UTC (+0000) instead of the sender’s local timezone.

Scenario

  • Users send emails from Outlook Desktop Application (Windows)
  • Users are in different timezones (e.g., IST +0530, PST -0800)
  • Fetching emails via EWS using IEWSClient
  • Need to display timestamps in sender’s original timezone

Code and Results

Fetching Email

IEWSClient client = EWSClient.getEWSClient(ewsUrl, username, password);
MapiMessage mapiMessage = client.fetchMessage(messageId);

Attempt 1: MapiMessage Standard Methods

Date deliveryTime = mapiMessage.getDeliveryTime();
Date clientSubmitTime = mapiMessage.getClientSubmitTime();
Date creationDate = mapiMessage.getCreationDate();

System.out.println(clientSubmitTime);
// Output: Thu Oct 30 15:28:10 UTC 2025  (UTC, not sender's timezone)

Attempt 2: MAPI Properties via getProperties()

MapiPropertyCollection properties = mapiMessage.getProperties();

// PR_MESSAGE_DELIVERY_TIME
MapiProperty deliveryTimeProp = properties.get_Item(0x0E060040L);
Date time = (Date) deliveryTimeProp.getData();
System.out.println(time);
// Output: 30-10-2025 22:28:11  (UTC)

Attempt 3: Timezone-Specific MAPI Properties

// PR_SENDER_TIME_ZONE
MapiProperty senderTz = properties.get_Item(0x0E09001FL);
System.out.println(senderTz);
// Output: null

// PidLidTimeZoneDescription  
MapiProperty tzDesc = properties.get_Item(0x8234001FL);
System.out.println(tzDesc);
// Output: null

// PidLidTimeZoneStruct
MapiProperty tzStruct = properties.get_Item(0x82330102L);
System.out.println(tzStruct);
// Output: null

Attempt 4: Email Headers

String dateHeader = mapiMessage.getHeaders().get("Date");
System.out.println(dateHeader);
// Output: Thu, 30 Oct 2025 15:28:10 +0000  (UTC, not +0530)

Attempt 5: Transport Message Headers

String transportHeaders = mapiMessage.getTransportMessageHeaders();
System.out.println(transportHeaders);
// Shows all Received headers with +0000 (UTC)

Attempt 6: MailMessage Class

MailMessage mailMessage = mapiMessage.toMailMessage(new MailConversionOptions());

Date date = mailMessage.getDate();
System.out.println(date);
// Output: Thu Oct 30 17:45:45 UTC 2025

String dateHeader = mailMessage.getHeaders().get_Item("Date");
System.out.println(dateHeader);
// Output: Thu, 30 Oct 2025 17:45:45 +0000

Attempt 7: Searching All Properties

for (MapiProperty prop : properties) {
    String name = prop.getName();
    if (name != null && 
        (name.toLowerCase().contains("time") || 
         name.toLowerCase().contains("zone") || 
         name.toLowerCase().contains("tz"))) {
        System.out.println(prop.getName() + ": " + prop.getData());
    }
}
// Output: (No properties found with timezone information)

Attempt 8: Named Properties

MapiNamedPropertyMappingStorage namedProps = mapiMessage.getNamedProperties();
if (namedProps != null) {
    System.out.println("Count: " + namedProps.getCount());
    // No timezone-related named properties found
}

Properties Checked (All NULL or UTC)

Property Tag Property Name Result
0x0E060040 PR_MESSAGE_DELIVERY_TIME UTC Date
0x00390040 PR_CLIENT_SUBMIT_TIME UTC Date
0x30070040 PR_CREATION_TIME UTC Date
0x0E09001F PR_SENDER_TIME_ZONE NULL
0x8234001F PidLidTimeZoneDescription NULL
0x82330102 PidLidTimeZoneStruct NULL
0x8257 PidLidAppointmentTimeZoneDefinitionRecur NULL
0x3FF10003 PR_MESSAGE_LOCALE_ID NULL

Actual Email Headers

Date: Thu, 30 Oct 2025 15:28:10 +0000
Received: from PNZPR01MB8313.INDPRD01.PROD.OUTLOOK.COM ... Thu, 30 Oct 2025 15:28:10 +0000
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2025 17:45:45.3263 (UTC)

All headers show UTC (+0000), not sender’s timezone (+0530).

Questions for Aspose Team

  1. Is there an Aspose.Email method or property we’re missing that can extract sender’s timezone?

  2. Does Aspose.Email provide any API to:

    • Access timezone information from TNEF data?
    • Parse timezone from Exchange-specific properties?
    • Retrieve sender’s mailbox timezone settings?
  3. Are there any extended MAPI properties that Aspose.Email can access that might contain timezone data?

  4. Is this a limitation of:

    • How Outlook sends emails (normalizes to UTC)?
    • Exchange Server (strips timezone)?
    • Or something Aspose.Email can work around?
  5. What is Aspose’s recommendation for scenarios where we need to track sender’s original timezone?

Environment Details

  • Aspose.Email for Java: [Version - please check your version]
  • Exchange Server: Office 365 / Exchange Online
  • Email Client: Microsoft Outlook Desktop (Windows)
  • Sender Timezone: IST (UTC+05:30)
  • Sender Location: India

Expected vs Actual

Expected Behavior:

  • Email sent at 8:58 PM IST
  • Date header: Thu, 30 Oct 2025 20:58:00 +0530

Actual Behavior:

  • Date header: Thu, 30 Oct 2025 15:28:10 +0000
  • All Aspose methods return UTC time

Use Case

Building an email processing application that:

  • Fetches emails from shared mailbox via EWS
  • Needs to display timestamps in sender’s original timezone
  • Needs to track when emails were sent (in sender’s local business hours)

Request

  • Is there any native Aspose.Email way to retrieve timezone?
  • Are we missing any methods, properties, or features?
  • Any guidance would be greatly appreciated!

Thank you for your help!

@jayanthr

To extract the original sender’s timezone from Outlook emails using Aspose.Email for Java with EWS, you may encounter limitations since standard properties and headers often return UTC time. Here are some insights and recommendations to help you:

  1. Missing Timezone Properties: The properties you checked (like PR_SENDER_TIME_ZONE and PidLidTimeZoneDescription) may return null, indicating that the timezone information might not be available in the email properties you are accessing.

  2. Email Headers: If the headers you retrieved show UTC timestamps, this suggests that the email might be normalized to UTC when sent. This is a common behavior in email systems to maintain consistency.

  3. Recommendations:

    • Check Sender’s Mailbox Settings: If possible, retrieve the sender’s mailbox settings to obtain their timezone. This may require additional permissions or API calls.
    • Use Client-Side Timezone: If you know the sender’s location or timezone, you can manually adjust the UTC time to the appropriate timezone using Java’s TimeZone class. For example:
      Date deliveryTime = mapiMessage.getDeliveryTime();
      TimeZone timeZone = TimeZone.getTimeZone("Asia/Kolkata"); // Example for IST
      Calendar calendar = Calendar.getInstance(timeZone);
      calendar.setTime(deliveryTime);
      System.out.println("Sender's Local Time: " + calendar.getTime());
      
  4. Extended MAPI Properties: If standard properties do not yield results, there may not be extended properties available through Aspose.Email that can provide the timezone data.

  5. Limitations: The behavior you are experiencing could be due to how Outlook and Exchange handle email timestamps, which often default to UTC. This is not necessarily a limitation of Aspose.Email but rather a characteristic of the email protocols and systems involved.

In summary, while there may not be a direct method in Aspose.Email to retrieve the sender’s timezone, you can work around this by adjusting the UTC time based on known timezone information or sender settings.

@jayanthr
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): EMAILJAVA-35416

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.