Parse inbox in Postfix using Java

坚强是说给别人听的谎言 提交于 2019-11-30 20:22:59

问题


I am using Postfix as a mail server and I configured it to receive emails to some destination.

I want to make a Java code that parse the incoming emails and do some action. Any idea where to start or what to use?


回答1:


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:

Getting mail from GMail into Java application using IMAP



来源:https://stackoverflow.com/questions/3127075/parse-inbox-in-postfix-using-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!