HOW-TO : Mail session and authentication password

2004-06-17 Thread Q\. Werty
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]



RE: HOW-TO : Mail session and authentication password

2004-06-17 Thread Carl Olivier
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.


Accdez au courrier lectronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,34/mn) ; tl : 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]



RE: HOW-TO : Mail session and authentication password

2004-06-17 Thread Q\. Werty
OK, thanks for you response. I've not understood how you
specify/pass your SMTPAuthenticator from JNDI resources.

What i want, is to be able to specify my SMTP password FROM
SERVER.XML and not from application (like JDBC resources). Is
your SMTPAuthenticator build by the application (and therefore
password is provided by the application) or build par the
contenair (and password is mentionned)?


 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]
 
 

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]