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

Free Support Forum - aspose.com

Aspose.Email.Mail.MailMessageLoadOptions' is obsolete


Today I upgraded Aspose.Email to the latest version and I'm getting the following 3 warnings for a single line of code...

  • Warning 2 'Public Shared Function Load(fileName As String, options As Aspose.Email.Mail.MailMessageLoadOptions) As Aspose.Email.Mail.MailMessage' is obsolete: 'Use method Load(string fileName, LoadOptions options) instead this.'
  • Warning 3 'Aspose.Email.Mail.MailMessageLoadOptions' is obsolete: 'Use LoadOptions with suitable MessageFormat instead this.'
  • Warning 4 'Public Shared ReadOnly Property DefaultEml As Aspose.Email.Mail.MailMessageLoadOptions' is obsolete: 'Use EmlLoadOptions instead this.'

I can't find any documentation advising on how to implement this change. Can you please confirm the following change is appropriate...

MailMessage.Load(fileName, MailMessageLoadOptions.DefaultEml)

Changed to:
MailMessage.Load(fileName, New EmlLoadOptions())

Hi David,

These methods have been marked as deprecated and will be removed in subsequent versions of the API. The new loading methods are as you found and suggested below . Please let us know if you need further help about this.


// Load from eml
MailMessage eml = MailMessage.Load(“test.eml”, new EmlLoadOptions());

// Load from html
MailMessage eml = MailMessage.Load(“test.html”, new HtmlLoadOptions());

// load from mhtml
MailMessage eml = MailMessage.Load(“test.mhtml”, new MhtmlLoadOptions());

// load from msg
MailMessage eml = MailMessage.Load(“test.msg”, new MsgLoadOptions());

// load from thef fomat
MailMessage eml = MailMessage.Load(“winmail.dat”, new TnefLoadOptions());

// loading with custom options
EmlLoadOptions opt = new EmlLoadOptions
PrefferedTextEncoding = Encoding.UTF8,
PreserveTnefAttachments = true

MailMessage eml = MailMessage.Load(“test.html”, opt);

HtmlLoadOptions opt = new HtmlLoadOptions
PrefferedTextEncoding = Encoding.UTF8,
ShouldAddPlainTextView = true,
PathToResources = @“D:\images”

MailMessage eml = MailMessage.Load(“test.html”, opt);