I have a web host that supports cPanel and email addresses. I'm interested in creating a web app that checks for email messages, reads their contents and then does something with them, like interact with a database.

For example, Bob with email bob@gmail.com links his email address to his account on my web app. He sends an email to storethis@webapp.com with subject "Shopping List" and message "Apples, bananas, kiwis, milk", along with an attachment. The web app receives this email, and then parses the email's contents and stores this data into a database.

How can I implement this?

  • 1
    Do remember that anyone can spoof the from field, so you shouldn't design a system this way if there's any potential for benefit by third parties, or potential for serious harassment to your clients. If there is, you probably need something more secure than email. Mar 23, 2013 at 4:15
  • If you're working in a unix environment, then it seems to me that the logical approach is for your web-server to interact with a cli email client to programatically read and respond to email based on input from http clients.
    – Racheet
    Jun 3, 2013 at 16:50

1 Answer 1


Java has JavaMail, which is a complete API for email servers and services. You could run a small java application which listens for the messages, processes them and acts accordingly (writing to a database, etc). It doesn't have to be a Web application per se, just some Java Beans which use the JavaMail API to register with the email service.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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