.NET

MailKit Converting a InternetAddressList to a MailAddressCollection

If you need to work with email in a .NET environment I highly recommend checking out MailKit by Jeffrey Stedfast. MailKit provides a higher level abstraction working across the different email protocols, which is a massive time saver.

MailKit has its own classes for handling Email Addresses. Most notability the MailboxAddress and InternetAddressList classes are returned when parsing a message envelope.

As powerful as the MailKit constructs are, I typically like to convert any 3rd party types into their .NET framework equivalents.  The below extension method adds a ToMailAddressCollection method to MailKit’s InternetAddressList class.