This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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: 5043
134
  • 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: 5043
134
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!