使用Java解析Postfix中的收件箱 [英] Parse inbox in Postfix using Java
问题描述
我将Postfix用作邮件服务器,并将其配置为接收到某个目的地的电子邮件.
I am using Postfix as a mail server and I configured it to receive emails to some destination.
我想编写一个Java代码来解析传入的电子邮件并执行一些操作.知道从哪里开始或使用什么吗?
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?
推荐答案
我看到两种方法:
- 例如使用jcup或jflex解析邮箱(或邮件)本身
- 添加imap服务器,并使用一些Java库查询imap服务器. (它可以为您提供过滤器)
通过imap方法,您可以选择未读邮件,按ID(单个或多个)的邮件,将邮件从一个目录移动到另一个目录等等.
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.
一些链接:
http://www.ibm.com/developerworks/linux /library/l-lexyac2.html
它用于C语言,但是技巧对Java可能会有所帮助.我的意思是理论背景.
It is for C, but tips may be helpful for java. I mean the theoretical background.
http://www.example-code.com/java/imap.asp
这是一个带有Java的imap示例的集合.它似乎使用了lib,但是在所有情况下,它都为您提供了imap可以执行的操作的概述.
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.
最后,在stackoverflow上存在有关imap和java的问题:
finally, there was a question about imap and java on stackoverflow:
这篇关于使用Java解析Postfix中的收件箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!