users@glassfish.java.net

Re: JavaMail datasource with TLS/SSL, username and password

From: Ryan de Laplante <ryan_at_ijws.com>
Date: Mon, 30 Jun 2008 15:16:20 -0400

Thanks. The thing is, I'm trying to set up a JavaMail DataSource for
the Roller 4.0 blog engine. I can't add code. Maybe there are no
properties I can add to a datasource to make this work, and Roller needs
to be changed to allow me to specify a username/password?


Thanks,
Ryan


Alexis Moussine-Pouchkine wrote:
> Hi Ryan,
>
> Would this help ?
>
> ...
> Properties props = new Properties();
> props.put("mail.smtp.auth", "true");
> props.put("mail.smtp.host", "smtp.host.foo");
> props.put("mail.smtp.port", "587");
> props.put("mail.from", "foo_at_bar.com");
>
> Authenticator auth = Utils.getAuthenticator();
> Session session = Session.getInstance(props, auth);
> session.setDebug(false);
> ...
>
>
>
> public static Authenticator getAuthenticator() {
> return new Authenticator() {
> @Override
> protected PasswordAuthentication
> getPasswordAuthentication() {
> return new PasswordAuthentication(user, password);
> }
> };
> }
>
>
>
> I'll admit I didn't use this with gmail but it does work with Sun's SMTP.
>
> -Alexis
>
> On Jun 30, 2008, at 19:25, Ryan de Laplante wrote:
>
>> Hi,
>>
>> I'm having difficulty figuring out how to configure a JavaMail
>> datasource for either my employer's SMTP server for GMail's. They
>> both use TLS, username and password.
>>
>> So far the most helpful page I found with JavaMail *properties* to
>> configure is here:
>>
>> http://www.jroller.com/eyallupu/entry/javamail_sending_embedded_image_in
>>
>> Can anyone help? How do I put in a username and password? I tried
>> mail.password but it still doesn't work.
>>
>>
>> Thanks,
>> Ryan
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>