示例#1
0
 public final Transport getTransport(final Session session) throws MessagingException {
   final Transport transport = session.getTransport("smtp"); // i18n lib
   transport.connect(
       cursorSMTP.getHost(),
       cursorSMTP.getPort(),
       cursorSMTP.getUser(),
       properties.getProperty(App.Settings.PASSWORD)); // i18n
   return transport;
 }
示例#2
0
 public final Session getSession() throws IOException {
   final Properties propertiesSession = new Properties();
   // properties.setProperty("mail.debug", "true");
   if ("starttls".equals(cursorSMTP.getProtocol())) { // i18n revisit
     propertiesSession.setProperty("mail.smtp.starttls.enable", Boolean.TRUE.toString());
   } else if ("smtps".equals(cursorSMTP.getProtocol())) { // i18n revisit
     propertiesSession.setProperty("mail.smtp.ssl.enable", Boolean.TRUE.toString());
   }
   setCustomSocketFactory(cursorSMTP.getCertificate(), propertiesSession);
   return Session.getInstance(propertiesSession);
 }