I'm using the smtp-mail library to send emails from my application with the sendMailWithLogin' function.
I would like to know if the email was successfully delivered or if it bounced. And if it bounced, with what error code? All of the functions return IO ()
and digging through the code it's a lot of layers of IO ()
. Is there some way to get this information with this library? Or is there perhaps some other library that can be used?
Unfortunately your software will have to become significantly more complex to support this. If you want to discover a bounce notification, you will at minimum need to be able to receive mail, which is not the purview of SMTP; you will need to make a POP or IMAP client. Also keep in mind that
Carl mentions that a MAIL FROM:<>
header usually indicates a bounce -- it may be that noticing this gets you most of the benefit with only a little extra work.