When we construct a MapiMessage, set PR_HTML property, and send the message to the target, PR_HTML property is available.
Message construction example:
using (MapiMessage mapiMessage = new MapiMessage())
{
mapiMessage.Subject = "test";
mapiMessage.Body = "test bodyy";
mapiMessage.SetProperty(new MapiProperty(MapiPropertyTag.PR_HTML, Encoding.Unicode.GetBytes(byteArray)));
if (mapiMessage.Properties.ContainsKey(MapiPropertyTag.PR_HTML))// this condition is true
{
}
}
When we construct a MapiMessage from MailMessage using FromMailMessage(mailMessage), set PR_HTML property, and send the message to the target, PR_HTML property is NOT available.
Message construction example:
using (var ms = new MemoryStream(byteArray))
{
using (MailMessage mailMessage = MailMessage.Load(ms))
{
using (MapiMessage mapiMessage = MapiMessage.FromMailMessage(mailMessage))
{
mapiMessage.SetProperty(new MapiProperty(MapiPropertyTag.PR_HTML, byteArray));
if (mapiMessage.Properties.ContainsKey(MapiPropertyTag.PR_HTML))// this condition is true
{
}
}
}
}
Why PR_HTML property is available in the first case, while NOT available in the second one?