问题
I'm looking to receive delivery notification from Exchange 2007, so that I can record whether an email has been received and resend if a set period elapses without an email being received.
Basically I want to send an email with a delivery receipt from ASP.NET, receive the delivered notification and then update my database to note that the email was actually received... Windows Service or some other way.
I'm in a closed environment - in that the emails in question are only sent internally to manager and other internal users, all using exchange - in the process of upgrading to Exchange 2007.
Whilst I can do some assumption, in that I can deal with ASP.NET throwing no exceptions when I send the email, however I want greater reassurance that the email has been delivered, so that if I don't receive a delivered notification then I can attempt to resend if a delivered notification hasn't been received within a certain period.
I'm open to any suggestions, ideally something that can simple receive notifications in an ASP.NET application or Console App, but if it's a case of getting Exchange 2007 to dump a file in a folder I can potentially deal with that, though it's not ideal.
I've heard Exchange 2007 has an API, but I have zero experience and knowledge of it, so a pointer in the right direction would be great.
回答1:
The notifications are sent to the mailbox specified as the sender in your emails, so you'll have to monitor this mailbox for changes. You can either poll that mailbox every once in a while or use push/pull notifications to be informed by the Exchange server about changes.
Use the EWS Managed API to access the mailbox: EWS Managed API - Download: http://www.microsoft.com/download/en/details.aspx?id=13480 EWS Managed API - SDK: http://msdn.microsoft.com/en-us/library/dd633710(v=exchg.80).aspx
This will also get you started with pull notifications, if required. Push notifications are more complicated, but you can use the code from my CodePlex project for this: http://exchangenotification.codeplex.com/.
来源:https://stackoverflow.com/questions/7407637/receive-email-notification-exchange-2007