• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Implement SMTP over TLS  RSS feed

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

We are using Javamail for sending Email however now I need to implement the TLS. I found that if we add the attribute mail.smtp.starttls.enable="true"/> then it will solve the purpose. However I want to know if we need to change the Java code as below along with setting this attribute?


{code}
Session session = Session.getInstance(props,
          new javax.mail.Authenticator() {
           
            //override the getPasswordAuthentication method
            protected PasswordAuthentication
                           getPasswordAuthentication() {
                                       
                return new PasswordAuthentication(username,
                                                 password);
            }
          });
{/code}
 
Saloon Keeper
Posts: 4749
117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Authentication and encryption are independent of one another - how you do one does not affect the other.
 
Abhishek Rath
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. In root.cml we defind the JNDI for mail

<Resource name="mail/Session" auth="Container" <br />         type="javax.mail.Session" <br />         username="<mail account username>" <br />         password="<mail account password>" <br />         mail.debug="false" <br />         mail.user="<mail account username>" <br />         mail.from="My wiki <email@domain.com>" <br />         mail.transport.protocol="smtp" <br />         mail.smtp.host= "<smtp mail host>" <br />         mail.smtp.auth= "true" <br />         mail.smtp.port= "<SMTP Server Port>" <!-- Default 25 --> <br />         mail.smtp.starttls.enable="true" <br />         description="Global E-Mail Resource" <br />     />

So when we set mail.smtp.starttls.enable="true"  , do we need to add the username , password , mail.user and mail.password or these are optional?
 
Tim Moores
Saloon Keeper
Posts: 4749
117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said, both topics are independent of one another. If you want encryption, use encryption. If you want authentication, use authentication. If you want both, use both.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!