}
properties.put("mail.transport.protocol", getTransport());
// Authentication if required
Authenticator authenticator = null;
if (getUsername() != null && getPassword() != null)
{
if (isSsl())
{
properties.put("mail.smtps.auth", "true");
}
else
{
properties.put("mail.smtp.auth", "true");
}
authenticator = new Authenticator()
{
@Override
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(getUsername(), getPassword());