How you parse a collection of email addresses with mimekit?



Question: How do you parse an email with invalide characters in MailKit when using C#?

Answer: See the code below, see the other article here.

 try
            {
                var mimeMessage = new MimeMessage();
                mimeMessage.To.Add(InternetAddress.Parse(email));
                mimeMessage.From.Add(new MailboxAddress(_emailSettings.Sender));
                mimeMessage.Bcc.Add(InternetAddress.Parse("YourEmailAddress"));

                mimeMessage.Subject = subject;

                mimeMessage.Body = new TextPart("html")
                {
                    Text = message
                };
Was this page helpful?
Yes Yes! this solution to the problem was helpful. No No! this solution to the problem was not helpful.. Leave ErnesTech Feedback.Feedback

Other users would like to know if this solution helped you.

Jack said:

Thank you this was helpful!!

Your Session is Ending
Login to Continue


© 2021 - ErnesTech - Privacy