I am using javax.mail to send mails in Java. Now that a part of the concept of my project changed I have to send a mail without authentication. I will have to change my crea
private void createSession() {
properties.put("mail.smtp.auth",false);
properties.put("mail.smtp.starttls.enable","true");
properties.put("mail.smtp.port","587");
properties.put("mail.smtp.host","smtp.gmail.com");
properties.put("mail.smtp.username","username(emailid")");
properties.put("mail.smtp.password","password(mail password)");
Session session=Session.getDefaultInstance(properties,null);
}
private void createSession() {
properties.put("mail.smtp.auth", "false");
//Put below to false, if no https is needed
properties.put("mail.smtp.starttls.enable", "true");
properties.put("mail.smtp.host", server);
properties.put("mail.smtp.port", port);
session = Session.getInstance(properties);
}
I think, this would suffice.