{"action":"created","issue":{"url":"https://api.github.com/repos/jstedfast/MailKit/issues/309","repository_url":"https://api.github.com/repos/jstedfast/MailKit","labels_url":"https://api.github.com/repos/jstedfast/MailKit/issues/309/labels{/name}","comments_url":"https://api.github.com/repos/jstedfast/MailKit/issues/309/comments","events_url":"https://api.github.com/repos/jstedfast/MailKit/issues/309/events","html_url":"https://github.com/jstedfast/MailKit/issues/309","id":139886026,"number":309,"title":"Sending to multiple recipients via SmtpClient fails entirely if any of the RCPT commands result in errors.","user":{"login":"NathanLBCooper","id":10466530,"avatar_url":"https://avatars.githubusercontent.com/u/10466530?v=3","gravatar_id":"","url":"https://api.github.com/users/NathanLBCooper","html_url":"https://github.com/NathanLBCooper","followers_url":"https://api.github.com/users/NathanLBCooper/followers","following_url":"https://api.github.com/users/NathanLBCooper/following{/other_user}","gists_url":"https://api.github.com/users/NathanLBCooper/gists{/gist_id}","starred_url":"https://api.github.com/users/NathanLBCooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NathanLBCooper/subscriptions","organizations_url":"https://api.github.com/users/NathanLBCooper/orgs","repos_url":"https://api.github.com/users/NathanLBCooper/repos","events_url":"https://api.github.com/users/NathanLBCooper/events{/privacy}","received_events_url":"https://api.github.com/users/NathanLBCooper/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jstedfast/MailKit/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/jstedfast/MailKit/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2016-03-10T13:30:00Z","updated_at":"2016-03-14T17:03:45Z","closed_at":"2016-03-12T02:39:20Z","body":"Let's say I use [SmtpClient](https://github.com/jstedfast/MailKit/blob/16cf225a4e194d0153d7f024b073e05f7cd7f639/MailKit/Net/Smtp/SmtpClient.cs) to deliver mail to two addresses `disabled@foo.com` and `valid@foo.com`. The first address causes the downstream server to return a `SmtpStatusCode.MailboxUnavailable` and the second address is just fine (`SmtpStatusCode.Ok`).\r\n\r\nThe method `ProcessRcptToResponse` will throw and noone will recieve any email. As the caller I will be able to see the exception (`SmtpCommandException (SmtpErrorCode.RecipientNotAccepted, response.StatusCode, mailbox, response.Response)`) and I'll be able to infer that a email to `disabled@foo.com` won't work.\r\n\r\nMy objectives are: 1) to send the message to whoever I can. 2) To know who I can't send messages to (so I can make bounce messages etc).\r\n\r\nI notice that your implementation decision was to ditch the whole SMTP conversation if one `RcptTo` fails. **Do you recommend any approach or pattern for callers who want to make a best effort attempt to send the email to as many recipients as possible?**\r\n\r\nI've thought about the approach of subclassing and overriding `ProcessRcptToResponse` to raise events and supress exceptions, but in in the event of everything failing continuing on to the `Bdat` and `Data` isn't correct. I can't see a non-hacky way to get this control flow right.\r\n\r\nI have also considered, outside the `SmtpClient`, stripping the recipients out, in turn, as they fail. But that doesn't seem like a good solution either,"},"comment":{"url":"https://api.github.com/repos/jstedfast/MailKit/issues/comments/196412923","html_url":"https://github.com/jstedfast/MailKit/issues/309#issuecomment-196412923","issue_url":"https://api.github.com/repos/jstedfast/MailKit/issues/309","id":196412923,"user":{"login":"TimTheTinker","id":984080,"avatar_url":"https://avatars.githubusercontent.com/u/984080?v=3","gravatar_id":"","url":"https://api.github.com/users/TimTheTinker","html_url":"https://github.com/TimTheTinker","followers_url":"https://api.github.com/users/TimTheTinker/followers","following_url":"https://api.github.com/users/TimTheTinker/following{/other_user}","gists_url":"https://api.github.com/users/TimTheTinker/gists{/gist_id}","starred_url":"https://api.github.com/users/TimTheTinker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimTheTinker/subscriptions","organizations_url":"https://api.github.com/users/TimTheTinker/orgs","repos_url":"https://api.github.com/users/TimTheTinker/repos","events_url":"https://api.github.com/users/TimTheTinker/events{/privacy}","received_events_url":"https://api.github.com/users/TimTheTinker/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T17:03:45Z","updated_at":"2016-03-14T17:03:45Z","body":"Thanks @jstedfast. "}}