Hi.

I extended an javax.mail.Authenticator to set username and password for SMTP
authentication:

        private static class SMTPAuthenticator extends Authenticator
        {
                String username, password;
                SMTPAuthenticator( String username, String password )
                {
                        this.username = username;
                        this.password = password;
                }
                public PasswordAuthentication getPasswordAuthentication()
                {
                        return new PasswordAuthentication( username,
password );
                }
        }


You then set mail.smtp.auth property to true

When constructing the MimeMessage, use a javax.mail.Session object created
using a Properties instance (with your properties set) and the instance of
the Authenticator (as above) that has the username and password set.

Hope that helps

Carl


-----Original Message-----
From: Q. Werty [mailto:[EMAIL PROTECTED] 
Sent: 17 June 2004 05:02 PM
To: tomcat-user
Subject: HOW-TO : Mail session and authentication password


How can I declare a JavaMail Session in server.xml with AUTHENTICATION
informations? It's OK for some properties (mail.smtp.port|from|user|auth)
but never found a way to indicate PASSWORD.


Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,34€/mn) ; tél : 08 92 68 13 50 (0,34€/mn)




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to