public final class JavaMailSessionBuilderImp extends Object implements JavaMailSessionBuilder
JavaMailSessionBuilderFactory.INSTANCE| Modifier and Type | Field and Description |
|---|---|
static String |
MAIL_SMTP_AUTH |
static String |
MAIL_SMTP_HOST |
static String |
MAIL_SMTP_PASSWORD |
static String |
MAIL_SMTP_PORT |
static String |
MAIL_SMTP_SSL_TRUST |
static String |
MAIL_SMTP_STARTTLS_ENABLE |
static String |
MAIL_SMTP_USER |
| Constructor and Description |
|---|
JavaMailSessionBuilderImp() |
| Modifier and Type | Method and Description |
|---|---|
JavaMailSession |
build()
Builds a new
Session object and returns wrapper. |
JavaMailSessionBuilder |
customPort(int port)
Sets a standard port number for SMTP gateway.
|
JavaMailSessionBuilder |
host(String host,
AlwaysTrustSSL alwaysTrustSSL)
Sets the hostname of SMTP gateway.
|
JavaMailSessionBuilder |
port(SmtpPort smtpPort)
Sets a standard port number for SMTP gateway.
|
Properties |
properties()
Optional: Directly access
Properties collection used to build final Session object. |
JavaMailSessionBuilder |
usernameAndPassword(String username,
String password)
Optional: Sets the username and password to authenticate with SMTP gateway.
|
public static final String MAIL_SMTP_STARTTLS_ENABLE
public static final String MAIL_SMTP_HOST
public static final String MAIL_SMTP_SSL_TRUST
public static final String MAIL_SMTP_PORT
public static final String MAIL_SMTP_USER
public static final String MAIL_SMTP_PASSWORD
public static final String MAIL_SMTP_AUTH
public JavaMailSessionBuilder host(String host, AlwaysTrustSSL alwaysTrustSSL)
host in interface JavaMailSessionBuilderhost - hostname of SMTP gateway, e.g., "smtp.gmail.com"
alwaysTrustSSL - set this option if you have trouble with SSL certificatesJavaMailSessionBuilder.port(SmtpPort)public JavaMailSessionBuilder port(SmtpPort smtpPort)
JavaMailSessionBuilder.customPort(int).port in interface JavaMailSessionBuilderJavaMailSessionBuilder.customPort(int)public JavaMailSessionBuilder customPort(int port)
JavaMailSessionBuilder.port(SmtpPort).customPort in interface JavaMailSessionBuilderport - must not be zero or negativeJavaMailSessionBuilder.port(SmtpPort)public JavaMailSessionBuilder usernameAndPassword(String username, String password)
usernameAndPassword in interface JavaMailSessionBuilderusername - must not be empty or all whitespacepassword - must not be empty or all whitespacepublic Properties properties()
Properties collection used to build final Session object.
Use this method if you need to customise properties before calling JavaMailSessionBuilder.build().
properties in interface JavaMailSessionBuilderpublic JavaMailSession build()
Session object and returns wrapper.build in interface JavaMailSessionBuilderSession.getInstance(Properties)Copyright © 2013–2020. All rights reserved.