Reputation: 8705
I have an Order Management (Web) Application (in Java/Java EE).
The application users want to Send Receive email communication to Customers who placed the Order, from within the Web-Application. The Email Trail must be associated with the Order.
The use-case is:
Questions:
Any ideas are welcome.
Upvotes: 8
Views: 6112
Reputation: 20691
If you're willing to take on the dependency, Spring Integration can comfortably read email from a designated server on a polling (POP3, IMAP) or event-driven basis (IMAP-IDLE). [1 & 3]
[2] You can use a dedicate mail account and filter the mail sent to downstream channels based on the subject (or other field) of the incoming mail. The following snippet from the Spring site illustrates this:
<int-mail:imap-idle-channel-adapter id="customAdapter"
store-uri="imaps://some_google_address:${password}@imap.gmail.com/INBOX"
channel="receiveChannel"
should-mark-messages-as-read="true"
java-mail-properties="javaMailProperties"
mail-filter-expression="subject matches '(?i).*Spring Integration.*'"/>
Where mail-filter-expression
filters the email that will be flushed down receiveChannel
. For all interested parties (channels), you'll have one <int-mail:imap-idle-channel-adapter/>
listening to your Exchange server.
While it's not cumbersome to use, I'd recommend you look at a short overview of EAI according to spring and of EAI in general
Upvotes: 5
Reputation: 4598
From a user point of view I think keeping a specific subject is more difficult. I would suggest a sub domain like myapp.myorg.com or a new domain like myapp.com
Either ways have a catch all so that all mails go to a specific email like [email protected]
Then your script can check the real TO. This might be more natural and 'cool' -> each order has its own mail id! On top of that use James or other mail software to get delivery to your code.
Upvotes: 1
Reputation: 3549
Receive emails Here is example code to read an email Are there any good short code examples that simply read a new gmail message?
Email account here For each user create an email account and have user's web app credentials used as credentials for email as well. Use hashed order id as part of subject to relate each email chain to specific order.
Microsoft Exchange Server Use either exJello is a JavaMail provider (http://www.exjello.org/) OR Use JavaMail API with DavMail Gateway (http://davmail.sourceforge.net/)
Upvotes: 3
Reputation: 1864
You need the following.
Upvotes: 3