Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Hi, I need to get unread emails from my inbox - to handle bounce-backs messages.
I don't need to get entire message. What I need is only: Subject and body only from unread e-mails.

I probably have to use IMAP, so could recommend me an "open-source" and good solution? so I can sell this software without any problems?

But, when smtp server don't support IMAP, I have to use POP3? That project will be good for that? Or maybe there is some other, better way ?

Thanks for help,

-----------------------------------------------------------------------------------------------

UPDATE:
I've got an idea.
I can read how many messages are in inbox. So, I also can get the last one.
I can check if there is a bounce-back message in timer (every 5 minutes for example). I could get messages one by one, and check the date. If the message was sent before 5 min ago, i would break.
In that solution, I will not get all messages from an inbox every time. Is that good solution ?

The pseudo-code of my idea:
C#
TIMER( Tick every 5minutes )
{
    (LOCK)
    loop(on inbox from end to begin)
    {
        // If the message date is older then "5 minutes ago" break
        if (message date < DateTime.Now.AddMinutes(-5);)
        {
            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.
            }
        }
        else
            break;
    }
    (UNLOCK)
}
Posted
Updated 14-Jul-11 23:24pm
v4

1 solution

POP3 does not have the capability to track unread emails. If your server does not support IMAP you try to use outlook automation.

Outlookintegration[^]


microsoft.office.interop.outlook._documentitem.unread.aspx[^]
 
Share this answer
 
v2
Comments
mnd017 14-Jul-11 11:16am    
Thank you, but I found <a href="http://www.afterlogic.com/mailbee-net/pop3-component">here</a> sth like that:
POP3 Object:
- Download entire messages
- Download headers only
- UNIQUE Download messages/headers in PIPELINING mode - can boost performance up to 1000%
- UNIQUE Download messages with a single line of code (QuickDownloadMessage)

How do you explain that?
luisnike19 14-Jul-11 15:50pm    
Yeah sure, there ar some components that can do that easier for you. I gave you free way to do it.
mnd017 14-Jul-11 17:14pm    
I've updated question a little bit, could you tell mi if this is good idea?
luisnike19 14-Jul-11 17:53pm    
That could work but I don't like that idea. That could cause a lot of time, let's think in a case when you always receive many e-mails by hour. You'll need to iterate each e-mail one by one and that will consume a lot of time and the process can be very slow. And then if a case you inbox has 100000 that will cause a lot of time to process just the last 5 min or something
mnd017 15-Jul-11 5:24am    
But, I'm not sure you understand me. The largest amount of emails, which I will have to read is as many as has been delivered in 5 last minutes. In my question I add a pseudo-code of the algorithm.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900