2

I would like to create an application using mailkit that will run on multiple servers, each targeting the same Exchange/IMAP mailbox looking for new mail, saving down its attachments and then deleting the mail.

There are many code samples to get me going but none that address protecting against 2 or more servers processing the same mail item. Is this possible? I had thought about using the SEEN flag - but would I get an error back if 2 servers tried to update it at the same time?

Thanks

  • Welcome to Stack Overflow! Please [edit] your question to show [the code you have so far](http://whathaveyoutried.com). You should include at least an outline (but preferably a [mcve]) of the code that you are having problems with, then we can try to help with the specific problem. You should also read [ask]. – Toby Speight Feb 28 '18 at 09:57

1 Answers1

1

You will want to try and take advantage of the IMAP \Recent flag which means that the message has not yet been seen by any other mail client.

Overall, though, it seems like you will have to deal with race conditions.

You might want to rethink your strategy of using multiple servers all hitting the same IMAP account.

jstedfast
  • 35,744
  • 5
  • 97
  • 110