List of usage examples for javax.mail Authenticator getPasswordAuthentication
protected PasswordAuthentication getPasswordAuthentication()
From source file:org.webguitoolkit.messagebox.mail.MailChannel.java
private Session getSession() { Authenticator authenticator = new Authenticator(); Properties sessionProps = new Properties(); sessionProps.setProperty("mail.smtp.submitter", authenticator.getPasswordAuthentication().getUserName()); sessionProps.setProperty("mail.smtp.auth", "true"); sessionProps.put("mail.smtp.starttls.enable", "true"); sessionProps.setProperty("mail.smtp.host", properties.getProperty("smtp.host")); sessionProps.setProperty("mail.smtp.port", properties.getProperty("smtp.port")); return Session.getInstance(sessionProps, authenticator); }