Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Let's have a program that checks an email mailbox and then "processes" the messages contained there. (For this question it doesn't really matter what it actually does with the message). The program will run once per hour and can easily handle the volume of new messages and there is no penalty for processing a message twice. Let's say it will be using the IMAP protocol and can perform any of the standard functions that an email application can do.

What mechanism would you recommend for processing the email?

  • Mark as read - the program marks a message as read after processing it.
  • Unmodified mailbox - the program doesn't modify the mailbox at all.
  • Something else - some other method I haven't thought of yet.

Suggestions welcome.

share|improve this question
2  
What is being done with the message is what really matters. Is it scanning for coupons sent to a user? Then leave the message along. Is it processing a helpdesk queue? Then mark the message as read. Is it downloading files sent to the mailbox? Then delete the mail after processing. –  Mike May 1 '13 at 18:31
    
Each message is converted to an alternate format and imported into another system. –  dustmachine May 1 '13 at 18:35
    
Why have you chosen polling instead of "at once" processing? –  Andrzej A. Filip May 2 '13 at 14:22
    
More email could arrive hourly/daily/whenever. –  dustmachine May 4 '13 at 5:05

1 Answer 1

up vote 5 down vote accepted

The best option will depend on what else you plan to do with the mailbox. If the answer is "nothing" then you should have your program delete mails from the mailbox. If the answer is "something" then your program should modify the mailbox in a way that plays nicely with the other clients that will be accessing the mailbox.

  • Delete the mail
  • Mark as read
  • Move to a folder
  • Apply an IMAP keyword
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.