SmtpFailedRecipientsException.InnerExceptions
is an array of SmtpFailedRecipientException
. I'd like to build a string that looks like:
"The following recipients failed: [joe@domain1.com, steve@domain2.com]. The email was sent to all other recipients succesfully"
SmtpFailedRecipientException.FailedRecipient
holds the email address.
I'm trying to work out if there's a way of using LINQ and/or lambda functions to effectively do a join
on this array, maybe converting it to a string[]
by reading SmtpFailedRecipientException.Message
or something along those lines, rather than writing a C-style for-loop?
This question (Getting all messages from InnerException(s)?) addresses the more general case of hierarchical nested exceptions, but that is not what I'm after... the asnwers there are significantly more complex than I need (as answers here demonstrate).