Reputation: 164
I have a daily process which sends me(actually the entire group) an email with two attachments zipped into one. I download the zip file, unzip it and forward one of the files out of the two to another group. The file which I forward after unzipping has a constant name pattern(for instance, it will always begin with ABC_Daily_*). I have to do this daily.
I want this to be automated. I am thinking of a windows service which will do the following:
Points 3-4 will be easy for me as I have done some work on it earlier. But I do not know how to know when a mail comes to a group's inbox. I do not know how to read the mail automatically and perform the actions mentioned.
Could you please guide through my problem? Any other ideas for implementing apart from the one I have mentioned are most welcome.
Upvotes: 0
Views: 1127
Reputation: 82136
I implemented a similar system a few years ago. What I did was implement a windows service which polled an exchange mailbox every X seconds and processed the emails in batches. One tip - depending on how frequent you need to poll you might find a console app driven by a scheduled task is more efficient (and less work).
For the actual mailbox interaction I used a couple of 3rd party libraries for processing and parsing the mail, pretty straightforward.
The difficulty with a system like this is making sure that emails are processed only once and dealing with problematic emails accordingly without blocking the service. For me it was as simple as moving the emails around into specific folders i.e. Processing
or Deadletter
.
I also had my service setup to email me reports on things like queue size, deadletter emails and any other general errors.
Upvotes: 1