Microsoft Outlook/Exchange server-side mail processing
I would like to be able to process incoming emails for a particular account. Things like parsing subject/body, process/save any attachments, upload processed data to a database, etc.
Another thing I have seen at one firm I worked at that I would like to be able to replicate, is setting up an email account that processes the subject of incoming emails and send the appropriate response back. For example, I send an email with the subject line "sales/NY/2010", the process recognizes the format, runs the appropriate query against a database, and sends back an HTML-formatted email with a table with the corresponding data.
Is VSTO the proper tool? I'd like to have a clean solution, server-side, so I don't have to resort to running an app/service that periodically开发者_Python百科 polls the inbox of a particular account for new items.
You want to look at Transport Agents (start here) for server side processing. Getting into the message body can be a bit challenging and takes more diving into the MIME classes, but the headers are nicely exposed.
What I do is run the application (a windows service developed in C#) in a polling mode (using a timer) that periodically checks all unread emails from an exchange mail account inbox folder and then processes them by storing in DB, moves them to a Processed or Error folder and marks the messaged as read.
You can retrieve messages from Exchange mailbox using webdav. We used a commercial library WebDAV.Net for this purpose.
The advantage is that this doesn't need outlook installed or any messing with Exchange server as well which can be a no go zone in an enterprise scenario.
精彩评论