Skip to content

Upgrading MailKit 2 to 3

Breaking2.15.0 → 3.6.0Breaking7Platform3New9Changed32Fixed27Other5

BreakingUpgrade verdict

7 breaking changes and 3 platform requirement changes.

  • Old ways of doing things that were already flagged as outdated in version 2 are gone.
  • Changing message flags now goes through Store with a request object; old methods still work as extension methods.
  • Changing labels now goes through Store with a request object; old methods still work as extension methods.
  • Fetching messages now uses a request object; the old call styles still work as extension methods to ease porting.
Top 5 of 10 that need code or config changes

Target frameworks requirement changed in 3.4.0: .NETFramework4.5, .NETFramework4.6, .NETFramework4.7, .NETFramework4.8, .NETStandard2.0, .NETStandard2.1, net5.0 → .NETFramework4.6.2, .NETFramework4.7, .NETFramework4.8, .NETStandard2.0, .NETStandard2.1, net6.0.

Breaking7
Removes APIs that were marked [Obsolete] in 2.x.
Replaces Add/Remove/SetFlags() with Store()/StoreAsync() taking a new IStoreFlagsRequest; old APIs become extension methods.
AddFlags()RemoveFlags()SetFlags()Store()StoreAsync()IStoreFlagsRequest
Replaces Add/Remove/SetLabels() with Store()/StoreAsync() taking a new IStoreLabelsRequest; old APIs become extension methods.
AddLabels()RemoveLabels()SetLabels()Store()StoreAsync()IStoreLabelsRequest
Simplifies Fetch()/FetchAsync() to take a new IFetchRequest parameter; previous APIs become extension methods.
Fetch()FetchAsync()IFetchRequest
Simplifies Append()/AppendAsync() to take a new IAppendRequest parameter; previous APIs become extension methods.
Append()AppendAsync()IAppendRequest
Simplifies Replace()/ReplaceAsync() to take a new IReplaceRequest parameter; previous APIs become extension methods.
Replace()ReplaceAsync()IReplaceRequest
SmtpClient.Send()/SendAsync() now return a string.
SmtpClient.Send()SmtpClient.SendAsync()
Platform3
Drops net5.0 support.
Drops support for net452 and net461.
Drops support for .NET 4.5 and replaces it with .NET 4.5.2.