Using the MailMessage object we were adding a custom header with the .Add_(“X-Custom”, “MyValue”)
We were saving this message to the drafts folder via AppendMessage.
Upon sending this email from Outlook or OWA,. the Sent Items folder contained the custom header in the mail options. However when the mail was received, the custom header was missing. This result happened no matter which user we logged into the EWS service with. It did however work for one user in particular (which we weren’t able to track why, perhaps a permissions issue).
We were using impersonation as well to save the draft in other user’s draft folders. But when we saw this issue we took this out of the equation in the event this was causing the issue. Removing impersonation however did not change the outcome, the headers were still stripped.
We then decided to use the EWS Managed API by Microsoft to achieve our goal. We added the custom header and saved the draft (through regular and impersonation) and after sending the draft from the client, the mail message contained the custom headers in the inbox of the recipient.
Is Aspose Email using the EWS Managed API under the hood at all? The only other big difference in code I noticed was that we are doing an auto discover on the service uri after providing the credentials, where in Aspose Email we have to specify the uri. Using EWS however, I specified the same uri we were passing to Aspose and the headers still came through appropriately.
Aspose.Email for .NET 4.0
Version 2.7.0.0
Thank you in advance and please let me know if you need any additional information.
Hi Frank,
Sorry for the inconvenience caused.
I have investigated this issue at my end and was able to observe the issue at my end. The headers are stripped off when the message is sent using Aspose EWS. I have reported this issue to our development team under issue id: NETWORKNET-33736 for further investigation, and will update you here once there is some information available in this regard.
PS: Could you please post the sample code that you used to achieve the same using EWS Managed API by Microsoft? This will help us log the comparative results along this ticket. We appreciate your cooperation in thsi regard.
Hi Kashif,
Thank you for the quick reply, below is the requested sample code:
using Microsoft.Exchange.WebServices.Data;
[…]
try
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.Credentials = new NetworkCredential(“userWithAppImpRoleAssignment”, “password”, “domain”);
service.AutodiscoverUrl(impUser);
Console.WriteLine(service.Url);
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, impUser);
EmailMessage msg = new EmailMessage(service);
msg.Subject = “testing”;
msg.Body = new MessageBody(“Sent by using EWS managed API”);
ExtendedPropertyDefinition header = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.InternetHeaders, “x-custom”, MapiPropertyType.String);
msg.SetExtendedProperty(header, “My custom header value”);
msg.Save(new FolderId(WellKnownFolderName.Drafts, new Mailbox(impUser)));
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Hi Frank,
Thank you for the additional information. We’ll log the additional information with the logged ticket for further consideration by development team. Once there is any update available in this regard, we’ll notify here via this thread.
The issues you have found earlier (filed as NETWORKNET-33736) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.