Well i have installed a NNTP provider from gnu.org :


- The current stable release of GNU JavaMail is version 1.1.2

- You need also the current versions of GNU JAF and GNU inetlib to build it.

Ungzip and make modification on build.xml (only location of install-dir)

inetlib project need 2 jars libs for compile :
javax-security.jar (see http://ftp.gnu.org/gnu/gnu-crypto/gnu-crypto-2.1.0-bin.zip)

jsse.jar (see http://java.sun.com/products/jsse/downloads/index.html)
or build jessie: http://savannah.nongnu.org/projects/jessie/

activation project no need jar!

Well we can compile the gnu mail project with activation.jar, inetlib.jar
Change build.xml only location of install-dir

Two jars file are generated after compile mail-1.1.2 :
- gnumail.jar
- gnumail-providers.jar

(Wow... I like gnu project that depend of 3 others projects and one external archive...)


Create a file 'javamail.providers' (see inside mail.jar of JavaMail 1.4 of Sun) :

# JavaMail IMAP provider Sun Microsystems, Inc
protocol=imap; type=store; class=com.sun.mail.imap.IMAPStore; vendor=Sun Microsystems, Inc;
protocol=imaps; type=store; class=com.sun.mail.imap.IMAPSSLStore; vendor=Sun Microsystems, Inc;
# JavaMail SMTP provider Sun Microsystems, Inc
protocol=smtp; type=transport; class=com.sun.mail.smtp.SMTPTransport; vendor=Sun Microsystems, Inc;
protocol=smtps; type=transport; class=com.sun.mail.smtp.SMTPSSLTransport; vendor=Sun Microsystems, Inc;
# JavaMail POP3 provider Sun Microsystems, Inc
protocol=pop3; type=store; class=com.sun.mail.pop3.POP3Store; vendor=Sun Microsystems, Inc;
protocol=pop3s; type=store; class=com.sun.mail.pop3.POP3SSLStore; vendor=Sun Microsystems, Inc;

# JavaMail NNTP provider dog@gnu.org
protocol=nntp; type=store; class=gnu.mail.providers.nntp.NNTPStore; vendor=dog@gnu.org;
protocol=nntp-post; type=transport; class=gnu.mail.providers.nntp.NNTPTransport; vendor=dog@gnu.org;

Install this file in your JRE (for me \j2sdk1.4.2_12\jre\lib\javamail.providers)
and install in classpath of your application two Jars gnumail-providers.jar & inetlib.jar

Now you can start your application that use JavaMail of Sun,
that will use gnu.mail.providers.nntp.NNTPStore for get message
and gnu.mail.providers.nntp.NNTPTransport for post nntp message

See chapter 'The Provider Registry' in JavaMail-1.4.pdf

Example :

        NNTP nntp = new NNTP("news.xxxxx.fr", null, null, 119);
            // WARNING : There are >45,000 newsgroups on !
            Folder[] root = nntp.getNNTPRoot(true);
            String home = System.getProperty("user.home");

            File a_F = new File(home, "newsng.txt");
            if (a_F.exists() && !a_F.delete()) throw new Exception("Can't overwrite '"+a_F.getName()+"'");

            RandomAccessFile f_In = null;
            f_In = new RandomAccessFile(a_F,"rw");

            if (root !=null)
                System.err.println("Root Folder : " + root.length);
                for (int i=0, n=root.length; i<n; i++)

            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in, "8859_1"));
            Message[] message = nntp.getNNTPMessage("fr.emplois.offres", true); //fr.test, control.cancel

            // Subscribed to folder, create file '${user.home}/.newsrc at end of session
            // under window make a 'touch .newsrc' with Cygwin or GNU Utilities for Win32

            System.err.println("Newsgroup  : " + nntp.getFolder());
            System.err.println("Separator  : " + nntp.getFolder().getSeparator());
            System.err.println("Message length : " + message.length);

            // inverse...
            for (int i = message.length-1, n = 0; n < i; i--)
                // warning From... we are in world of usenet!
                System.err.println(i + " from : " + NNTP.getFrom(message[i]) + "\tsubject : " + message[i].getSubject());
                System.out.println("Do you want to read message?" + " [YES to read/QUIT to end]");
                String line = reader.readLine();

                // Mark as seen if appropriate
                if ("YES".equals(line))
                    // write output message

                    // flagged seen
                    //message[i].setFlag(javax.mail.Flags.Flag.SEEN, true);
                else if ("QUIT".equals(line))

            //nntp.post("Neo@whatisthematrix.real", "jp.test", "test -ignore", "Welcome to the reality!");
            //nntp.cancel("Neo@whatisthematrix.real", "jp.test", "<8379614.011xxxx406.JavaNNTP.Franck@Nexus>");
        catch (Exception e)
            System.out.println("Pile : ");
            // ferme la session nntp
            try { nntp.close(true); } catch (MessagingException me)    {}

Source : NNTP.java