Java/linux Email processor

David Ash dash at redhat.com
Tue Oct 24 04:10:08 CST 2006


Thomas Sprinkmeier wrote:
> Dave,
> 
> 
>>The way I was thinking about setting this up was:
>>-/etc/aliases file with appropriate entry eg.
>>  {somealias}|java {myapp}
>>-Read email from stdin and process
> 
> 
> I've done this sort of stuff, not in Java though.

what did you use?

>>Fairly high level thoughts at the moment.  But anyone have any thoughts 
>>on this?  Eg.
>>-Easier way to do it.....
>>-or "don't do it".
>>-Good java api's
> 
> 
> Java has a mail API.
> You could deliver the email as normal and have java use POP to retrieve
> them.
> 
> Seems slightly neater (i.e. it will work against any MTA).

I like the idea of events happening straight away rather than through 
cron.  Although I have used the mail api, and I would rather use an api 
than reinvent the wheel for reading mail.

Looking further into the mail api looks like I may be able to do this 
with stdin as an input stream maybe:

SMTPMessage(Session session, java.io.InputStream is)
           Constructs an SMTPMessage by reading and parsing the data 
from the specified MIME InputStream.

Will read further.

Regards
Dash


More information about the linuxsa mailing list