Win a copy of Kotlin for Android App Development this week in the Kotlin 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
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 5228
143
  • 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: 5228
143
  • 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.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!