M
M
Max2014-11-26 09:04:40
Java
Max, 2014-11-26 09:04:40

How to set up integration with email (data upload and download) in Java?

Hello!
To communicate with clients, we use a self-written chat - a regular chat with messages, attachments, and more. Clients access their personal account through the web and can communicate with us. If we reply to a client's message, the client receives an email with the text of the new message and a link.
Everything is fine, but in order to respond to a message, the client has to go to our site, log in and respond. And this is not very convenient.
Clients want to write to the chat via mail
It is necessary to set up integration with the mail server in such a way that the client can simply reply to the message via mail and his message will automatically get into the chat.
And also give the opportunity to create new messages via mail - just send an email to a special address and as soon as the letter arrives on our server, it should automatically go to the client's chat.
Basecamp has such an integration . And Evernote has the ability to create new notes via mail - you send an email to a special address and Evernote creates a note in your notebook.
I would like to ask if anyone knows ready-made solutions for such a task in Java?
Requirements:
1. So that the mail server, as soon as it receives a letter, calls the method of our web service and transfers all the information from the letter (subject, text, attachment).
2. As soon as a new message is created in the chat, we transfer the data to the mail server, on which a mailbox alias is created (in which the message id is encrypted) and a letter is sent from it to the client. The mailbox alias is needed so that as soon as the client answers this mailbox, we can associate his answer with the necessary correspondence.
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikolai Pavlov, 2014-11-26
@gurinderu

Embed javax.mail in your webserver and pick up the emails you need. Here the most difficult thing is routing to the right person in the chat.

A
Alexey Cheremisin, 2014-11-26
@leahch

Well, first, you need a simple mailer like exim/postfix.
1) On the arrival of letters:
In the mailer, we make an alias to the pipe, which launches the program and sends it the full text of the message. The alias naturally belongs to the recipient box.
In Exim it is done like this
www.exim.org/exim-html-current/doc/html/spec_html/...
The program reads the letter either from standard input/output or takes it from a file, here you can set it up. The program can also be written in Java, which connects to the application and pushes mail there!
2) To send emails from the application - use jakarta.commons.email, it's just convenient and accessible - commons.apache.org/proper/commons-email/userguide.html
PS. And yes, in the mailer you can make a redirect to the pipe at least part of the addressmycoollist-XXXXX, at least by the body of the letter or header "[thread-d-XXXXXXX]", as you set up the mailer, it will be so.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question