Dealing with bounce-backs emails (only POP3, without IMAP)
I want to ask about dealing with bounce-backs emails (but on server without IMAP, only with POP3, and without an Outlook on my machine). I don’t want to read all emails from server every time.
So I thought, At first: 1. read e-mails from the oldest to the newest, checking whether there are bounce-backs. 2. save the date of the latest e-mail to the variable "TEMPDATA" //This process will be executed only once, at the beginning
And then in timer loop (in another thread): 3. read e-mails from the "TEMPDATA" to the newest, checking whether there are bounce-backs (check if there is a subject “"Undelivered Mail Returned to Sender"”.)
The pseudo-code of my idea:
TIMER( Tick every 5minutes )
{
(LOCK)
loop(on inbox from the "TEM开发者_运维百科PDATA" to the newest)
{
// Read single email
if (the subject is "Undelivered Mail Returned to Sender")
{
// Here I will parse message so that I will know the addresse
// And removie that addresse from my list.
}
}
(UNLOCK)
}
I’m just curious if there is some better solution.
If you are planning to use IMAP protocol I'd rather use email UID than date.
Checking only the subject is not the bast way to check, if the message is delivery failure report. Some emails will have different subject (different language). Gmail for example uses additional header. Most delivery failure emails however follow RFC3464 specification and use Delivery Status Notification (DSN) format.
You can try using Mail.dll component for this:
http://www.lesnikowski.com/blog/index.php/bounce-handling/
Please note that this is a commercial product I created.
I know this is an old question, but it shows up high in search results, so here's to hoping it helps others.
I found this open source solution:
https://mailsystem.codeplex.com/
Seems to be working well for us so far. Documentation is pretty much non-existent, though the Visual Studio intelli-sense is pretty detailed.
精彩评论