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

Free Support Forum - aspose.com

Forwrding email and keeping the format

I am using aspose email to forward an email message from exchange. The email is forwarding, but the recipient is receiving the email in text format and not in the original html format.

Is there a way to forward the email and keep it in html format?


I just want to be able to forward the email keeping the original format.



Here is a snippet of code I am using

For example,

private IEWSClient _client;
_client = EWSClient.GetEWSClient(…)

var mailMessage = new MailMessage(fromEmailAddress, toSenderEmail, messageSubject, messageBodyPrefix);

_client.Forward(mailMessage, exchangeMessage.asp
oseExchangeMessageInfo);

Any help or ideas is much appreciated. Thanks.

Hi,

Thank you for posting your inquiry.

Please try setting MailMessage.IsBodyHtml flag to true to retain HTML format in the forwarded message. Please see sample code below:

var mailMessage = new MailMessage("from@domain.com", "to@domain.com", "Forward Message", "This message is forwarded");

mailMessage.IsBodyHtml = true;

IEWSClient _client = EWSClient.GetEWSClient("https://servername/ews/exchange.asmx", "from@domain.com", "password");

ExchangeMessageInfo exchangeMessageInfo = _client.ListMessages("Inbox").First();

_client.Forward(mailMessage, exchangeMessageInfo);

<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

<![endif]–>
Please try the above suggested change at your end and let us know if it meets your needs.

Setting the MailMessage.IsBodyHtml flag worked and fixed the original issue, but I noticed the Sent date that is showing in the detail section of the email that was forward is in the wrong time zone.



The exchangeMessageInfo properties is showing the "prior email"DateTimeSent as:

02/03/2017 1:17:42 PM

But when the email is forwarded the email is showing:

02/03/2017 5:17:42 PM



Is there a way to get the forwarded email to have the “prior email” show the correct time zone?

Hi,

Thank you for the feedback.

We are unable to observe any difference in ExchangeMessageInfo.Date and the date time of the forwarded message. ExchangeMessageInfo.Date is in UTC and it reflected the same in the forwarded message.

Please share your complete sample code to reproduce the issue at our end. We’ll look into it further to assist you accordingly.

When forwarding messages using the example code below that you sent me, it is forwarding the message using the UTC time zone.

Is there a way to forward the message using the eastern time zone?

For example, someone on the eastern time zone sent an email and it went into inbox on the eastern time zone at 13:17:42. If I take this message and forward it to a different person on the eastern time zone, then when they see the forwarded message in their inbox they see the original email sent date in UTC time as 17:17:42 and not 13:17:42.

Here is the code that you had sent me and that I am using to forward the email.

var mailMessage = new MailMessage("from@domain.com", "to@domain.com", “Forward Message”, “This message is forwarded”);
mailMessage.IsBodyHtml = true;
IEWSClient _client = EWSClient.GetEWSClient(“https://servername/ews/exchange.asmx”, "from@domain.com", “password”);

ExchangeMessageInfo exchangeMessageInfo = _client.ListMessages(“Inbox”).First();

_client.Forward(mailMessage,

exchangeMessageInfo);

Hi,


The Time zone information is associated with the message by the Exchange server and Aspose.Email API doesn’t have control over it. TimezoneId property specified by IEWSClient provides the provision to set timzone context of headers for server requests. However, if you still notice any differences of this behavior as compared to MS Outlook, please share with us your findings for further analysis at our end. We’ll look into these for assisting you further.