问题
I'm setting up an automated response with a third party. The third party can only respond via e-mail, so I need a way to determine when I get a new e-mail. My plan is to create a windows task that will run a C# program that checks to see if a new e-mail is from this third party.
My company uses outlook, which runs off of the Microsoft Exchange database. I did some research, and I saw that some people use the Microsoft MAPI namespace. Is this the way to go about it? Is there some way that I can use System.Net.Mail to check for new mail from a particular address?
Thanks, Aaron
回答1:
Depending on your requirements you could use Outlook Interop / MAPI which is simply using Outlook from code - in this case look at: Microsoft.Office.Interop.Outlook assembly. This has the benefit of an event firing on new items popping up in your mailbox.
On the other hand if your server supports POP3, you can simply get random POP3 libray and periodically query the server.
来源:https://stackoverflow.com/questions/1106212/programmatically-checking-for-outlook-e-mails