Just out of interest, is there any reason you don't want to setup a
JNDI Mail session?
I am using a JNDI Mail Session in GlassFish V2. I'm asking which
properties I need to add to it so that I can have both SSL and
username/password.
I don't believe you can set username/password for container managed
mail sessions on Tomcat or Glassfish. That's why we have the plain old
mail setup (i.e. not container managed, not JNDI), which does allow
you to set username/password -- but does not do anything to configure
SSL (your code example doesn't seem to do SSL either).
Here's what you'd add to your roller-custom.properties file to setup
mail with username and password:
mail.configurationType=properties
mail.hostname=smtp-server.example.com
mail.username=scott
mail.password=tiger
I found this example on the net:
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.debug", "true");
Session session = Session.getInstance(props);
That gets me SSL in my JavaMail datasource, but not username/password.
If I choose to use roller-custom.properties to configure mail instead of
my JNDI datasource, I can do username/password but not SSL. Can Roller
be enhanced to allow both? As it is now I can't use the SMTP server at
work, my ISP, or gmail because they all require SSL, username and
password.
Thanks,
Ryan