views:

30

answers:

1

greetings all i am using postfix as a mail server and i configured it to receive emails to some destination and i want to make a java code that parse the incoming emails and do some action any idea where to start, what to use, links and tutorials would be much appreciated.

A: 

I see two approaches:

  • Parse the mailbox (or mail) itself using jcup or jflex for instance
  • Add an imap server and use some java lib to query the imap server. (it can provide you filters for instance)

The imap approach lets you select unread mail, mail by id (single or multiple), move mail from one directory to an other, and so on.

Some links:

http://www.ibm.com/developerworks/linux/library/l-lexyac2.html

It is for C, but tips may be helpful for java. I mean the theoretical background.

http://www.example-code.com/java/imap.asp

This one is a collection of imap sample with java. It seems to use a lib, but in all case, it gives you an overview of what is doable with imap.

finally, there was a question about imap and java on stackoverflow:

http://stackoverflow.com/questions/61176/getting-mail-from-gmail-into-java-application-using-imap

Aif
what do you think is the easiest ?and can you please give me some guide and useful links if possible?
sword101
I think that the easiest is to use imap, but it really depends on what you want to search / filter and so, and where your tool should be (on the server or not). An other piece of fun is to pipe your program in the master.cf :-)The tip for jcup of jflex was because you used the word "parse".
Aif
i want first to configure postfix to receive emailsthen i want to make a listener on the server to listen for incoming emails and do actions on them
sword101

related questions