MailKit ToMailAddressCollection Extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class MailKitExts | |
{ | |
public static MailAddressCollection ToMailAddressCollection(this InternetAddressList addressList) | |
{ | |
if(addressList == null) | |
{ | |
return new MailAddressCollection(); | |
} | |
return addressList.Mailboxes.Aggregate(new MailAddressCollection(), (c, r) => { c.Add(new MailAddress(r.Address, r.Name)); return c; }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment