Aspose Mail Sender date display format


#1

Hi.
I am using the Aspose email.
Use case:-
Lets say I have an email with timezone A.
And another email with timezone B.
I send it to system with timezone C.
Aspose is used on system C to render msg to mhtml.
How can I keep the sender format to the original timezone of the email. So, in this case I want respective mails to be in timzone A and timezone B.
Can this be done automatically without explicitly setting the timezone everytime.

Regards,
Ankur Vashishtha


#2

Original Sender timezone looks like this
original.PNG (47.2 KB)

If we give default value, then
Default is Default.PNG (22.6 KB)

If we provide particular timezone, then
particular_timezone.PNG (27.4 KB)

is it possible to somehow configure aspsoe so that the timezone in the rendition will stay the same like in original msg email?
Ex: If an email has been sent on 10am UTC+2 we would expect the rendition to be created with the same timestamp rather than getting converted to the user locale settings.

Sample code:-

public static void main(String args[]) throws Exception {
try {
loadLicense();
} catch (Exception e) {
e.printStackTrace();
}

MailMessage message = MailMessage.load(“C:\Users\abc\Downloads\Patch\igor\Email\input.msg”);
String simpleDateFormat = “E dd-MM-yyyy HH:mm”;
String timeZone = “default”;
if(timeZone != null && !timeZone.equalsIgnoreCase(“default”))
message.setTimeZoneOffset(TimeZone.getTimeZone(timeZone).getOffset(0)); //required to show “Sent” time based on Locale
String mhtFile = “output.mhtml”;
MhtSaveOptions mhtSaveOptions = new MhtSaveOptions();
if(simpleDateFormat != null && !simpleDateFormat.equalsIgnoreCase(“default”))
{
String timeFormatted = new SimpleDateFormat(simpleDateFormat).format(message.getDate());
String time = mhtSaveOptions.getFormatTemplates().get_Item(“Sent”).replace("{0}", timeFormatted);
mhtSaveOptions.getFormatTemplates().set_Item(“Sent”, time);
}
mhtSaveOptions.setMhtFormatOptions(MhtFormatOptions.WriteHeader | MhtFormatOptions.HideExtraPrintHeader|MhtFormatOptions.DisplayAsOutlook);
message.save(“C:\Users\abc\Downloads\Patch\igor\Email\output_1822.mhtml”, mhtSaveOptions);

}


#3

@AjeshEMC

Thank you for contacting to us.

The MailMessage class can be used to retrieve message date in UTC or local timezone. This information can be summarized as follow:

  1. MailMessage.getDate() - returns date in UTC
  2. MailMessage.getLocalDate() - returns date in local TimeZone
  3. MailMessage.isLocalDate Returns true, if MailMessage.Date is in local timezone

As per our understanding, you want to retain the first senders timezone for MSG even if it is sent again. Please correct if our understanding is wrong.

Moreover, we are working on this and you will be update here as soon as we finish our investigation. Meanwhile, it is requested to kindly share sample MSG files with us for better understanding of the issue.


#4

Yes that is true.
I am attaching the sample input file.Test.zip (14.4 KB)

Thanks a lot for the quick reply.

Regards,
Ankur Vashishtha


#5

@AjeshEMC

In general, the Date Time properties are stored in UTC for MSG but Outlook displays time in local Time Zone of current machine. For EML, the Time Zone information is stored in Date headers like as:
Date: Wed, 20 Jan 2010 23:18:37 +0300

In your case, you may set the time zone manually for the MSG while sending as you are doing in your sample code instead of setting time zone to default set it to the actual time zone that you want to retain.


#6

Hi,
Is it possible to set it automatically as the mail could be from different senders having different time zones?

Regards,
Ankur


#7

@AjeshEMC

Thank for your writing back to us.
The Date Time properties are stored in UTC and displays time in local Time Zone of current machine. It is not possible to set it automatically for re-sender. However, in case of forwarding MSG as an attachment could retain original senders time zone.

Moreover, the customized logic can be developed to set it manually using Aspose API if all the senders are using same application.


#8

What if the senders are all in different time zones ?
What do you mena by ‘if all senders are using the same application’

And can you log a feature request for the same?
Regards,
Ankur Vashishtha


#9

@AjeshEMC

Thank you for writing back to us.
If all senders are using the same customized application built using Aspose API with functionality to retain Time Zone shall work.

Moreover, it is requested to please elaborate the required feature in details. Do you want functionality to set timezone automatically to first senders time zone for the message, while re sending (not forwarding) the same message?


#10

Hi.

Use case:-
Lets say I have an email with timezone A.
And another email with timezone B.
I send it to system with timezone C.

Aspose is used on system C to render msg to mhtml.
How can I keep the sender format to the original timezone of the email. So, in this case I want respective mails to be in timzone A and timezone B.
Meaning the 2 mhtml’s generated should be having the their sender time zones.
In one case A and another B, even though it is getting rendered to mhtml at C.
Can this be done automatically without explicitly setting the timezone everytime.

Regards,


#11

@AjeshEMC

We have logged your requirement with ID “EMAILNET-39221” for further investigation. You will automatically be informed here once we have more information.