Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com
Need these packages, in the Enterprise Edition, j2ee.jar.
Add the smtp host name as system property.
Get a javax.mail.Session .
Make a message.
Connect to smtp-host.
Connect to pop3 server.
Get INBOX messages.
First message only shown here, could save it to file or database .
Server will NOT delete messages (yet).
Mail + attached file
A message's text part ...
The file attached.
Compose the two ...
as Multipart message content.
Message is deleted when folder is closed with boolean true.
Deleting before closing is possible, too, but the remaining messages will be renumbered !
Policy file, if needed, for instance, in an application server/servlet engine.
Permission to read default configuration files inside j2ee.jar .
To find and connect to SMTP-host.
To connect to POP3-host.
To access System Properties.
See exactly what happens, if you're having problems.