Object EMail send email with some options, accept protocol SMTP and SMTPS over SSL :

Sun JavaMail API 1.4 (under GPL v2) : http://java.sun.com/products/javamail/ 
 - mail.jar 1.4 (pop3.jar, smtp.jar, imap.jar, mailapi.jar, dsn.jar)
JAF :  http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp 
- activation.jar

SSL explain and example :
We need to put SSL certificat in key store manager inside JRE...

Well see URL : https://altern.org/ with your browser.
And export SSL certificate of site web in file ex : altern.cer

Now import SSL certificate in key store manager :
go in path \j2sdk1.4.x_xx\jre\lib\security\
and use keytool with some options :
$> keytool -import -keystore cacerts -file altern.cer

The password by default of global key store manager is : 'changeit'

Now we can communicate with the domain in POP or SMTP over SSL...

Example :

        //Pop3 pop = new Pop3("c:\\temp", "pop.xxxx.fr", "xxxx", "xxxx");
        EMail fox = new EMail("smtp.gmail.com"); //smtp.xxx.com

            //Message[] pop_message = pop.getMail(true);

            //for (int i = 0, n = pop_message.length; i < n; i++)

                // SSL connexion ?
                fox.setSecureSMTP(true); // defaut false
                fox.setPort(465); // gmail 25 (Ok ssl false), 465 (ok SSL true), 587 (Ok ssl false!), default port 25
                fox.setAuthentication("xxxx@gmail.com", "xxxx"); // active l'envoie du mail avec authentification !!!

                fox.setTLS(true); // mandatory for gmail
                //fox.setQuitWait(false); // mandatory for gmail
                // active le débuggage

                // active l'envoie du mail partiel, si une des adresses emails n'est pas valide!!!

                // ajouter un destinataire

                // attacher un destinataire d'adresse de reponse

                // priorité du mail : 0 basse, 1 moyenne, 2 haute

                // envoi du mail
                // ordre des aguments : from, to , subject, body, files
                //fox.sendMail("test@xxxx.fr", "faa@xxxx.fr", "test accents ê ô é è à ù €", "Haloa ê ô é è à ù €!!!");

                fox.setSubject("test coucou");
                fox.setBody("<b>test coucou</b>"); // html true!

                // exemple piece jointe
                //fox.sendMail("test@xxxx.fr", "fandriano@xxxx.fr", "test accents ê ô é è à ù €", "Haloa ê ô é è à ù €!!!", "C:\\temp\\date_serial.ser");

                // exemple liste de pieces jointes
                String[] filesname =

                fox.sendMail("test@xxxx.fr", "faa@xxxx.fr", "test", "Haloa !!! ", filesname);

                // exemple forward
                //fox.sendForward("test@xxxx.fr", "faa@xxxx.fr", "ceci est un forward!", pop_message[i]);

                // exemple redirect
                //fox.sendRedirect("test@xxxx.fr", "aa@xxx.fr", pop_message[i]);

                // efface le message du serveur pop3
                //pop_message[i].setFlag(javax.mail.Flags.Flag.DELETED, true);

        catch (Exception e)
            // ferme la session pop3 et efface les messages flagger 'DELETED' !
            /* try { pop.close(true); } catch (MessagingException me) { } */

Source :  EMail.java