I want to send email from my java application, through my gmail account. I'm using apache-commons-email 1.4. I have following code
HtmlEmail email = new HtmlEmail();
email.setHostName(hostName);
email.setSmtpPort(port);
email.setAuthenticator(defaultAutenticator);
email.setSSLOnConnect(true);
//email.setStartTLSEnabled(true);
//email.setStartTLSRequired(true);
email.setFrom(from);
email.setSubject(title);
email.setHtmlMsg(htmlContent);
email.setTextMsg(textContent);
email.addTo(recipient);
email.send();
This code works ok. My question is: What better to use SSL or TLS? Can I use them together?
As I understand from web search they are almost the same but SSL start encryption automatically on start of connection and TLS is not. So does it mean that SSL more secure?