I have a task of reading emails from Lotus Dominos mailbox. To perform the same I am have following two options (there might be other options as well):
What is difference in both? Capabilities or something else?
Write a Java Agent to run inside the email server
Pros
Cons
Reason for personal opinion
I wrote a client that used IMAP to read emails inside an inbox periodically and I set up a James Mail Server with something like the agent you are talking about to programmatically respond to emails that were received by an email address. I tend to like your option 1 (a Java agent running inside the email server) because it lets you leverage all of the resiliency of the email server itself. The code can be reasonably guaranteed to start and stop with the email server and it's logging is connected to the logging of the server. Making a stand alone agent has the benefit of working with servers other than your initial configuration (especially if you leverage standard protocols). But you have to do more to make sure it is operational and you have to work harder to debug (in my own experience). Also, the Java Agent approach tends to be smaller so there is less code to manage.