I am finding myself frequently sending hundreds of SMTP emails via a loop in a script. Some of the emails do not get sent because of either bad email addresses or TLS issues (sometimes switching from TLS to SSL fixes the issue).
Is there a way of flagging the emails that did not send? E.g. Sometimes from 100 emails, 20 do not send, and because they are being sent in a loop, it is difficult to track which ones sent and which ones did not. I do not want to send duplicate emails.