Package edu.uiuc.ncsa.security.util.mail
Class MailEnvironment
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.util.AbstractEnvironment
-
- edu.uiuc.ncsa.security.util.mail.MailEnvironment
-
- All Implemented Interfaces:
ConfigurationTags
,Logable
,MailConfigurationTags
public class MailEnvironment extends AbstractEnvironment implements MailConfigurationTags
Created by Jeff Gaynor
on 11/7/23 at 12:31 AM
-
-
Field Summary
Fields Modifier and Type Field Description static String
ADDRESS_SEPARATOR
The separator between email addresses.List<String>
blindCarbonCopy
List<String>
carbonCopy
String
contentType
String
from
boolean
mailEnabled
String
messageTemplate
String
password
int
port
List<String>
recipients
String
replyTo
String
server
boolean
starttls
String
subjectTemplate
String
username
boolean
useSSL
-
Fields inherited from class edu.uiuc.ncsa.security.core.util.AbstractEnvironment
constants
-
Fields inherited from interface edu.uiuc.ncsa.security.core.configuration.ConfigurationTags
DEBUG
-
Fields inherited from interface edu.uiuc.ncsa.security.util.mail.MailConfigurationTags
MAIL, MAIL_COMPONENT, MAIL_CONFIG_ADMIN, MAIL_CONFIG_ALERTS, MAIL_CONFIG_DEFAULT_NAME, MAIL_CONFIG_HELP, MAIL_CONFIG_ROOT, MAIL_ENABLED, MAIL_FAIL_ON_MISSING_CONFIG, MAIL_MESSAGE_TEMPLATE, MAIL_NAME, MAIL_PARENT, MAIL_PASSWORD, MAIL_PORT, MAIL_RECIPIENTS, MAIL_SERVER, MAIL_START_TLS, MAIL_SUBJECT_TEMPLATE, MAIL_USE_SSL, MAIL_USERNAME
-
-
Constructor Summary
Constructors Constructor Description MailEnvironment()
MailEnvironment(boolean mailEnabled)
MailEnvironment(boolean mailEnabled, String server, int port, String password, String from, String recipients, String messageTemplate, String subjectTemplate, boolean useSSL, boolean starttls)
MailEnvironment(Map<String,Object> map)
Populate from a map
-
Method Summary
-
Methods inherited from class edu.uiuc.ncsa.security.core.util.AbstractEnvironment
debug, error, getConstants, getMyLogger, info, isDebugOn, isPingable, setDebugOn, setPingable, warn
-
-
-
-
Field Detail
-
ADDRESS_SEPARATOR
public static String ADDRESS_SEPARATOR
The separator between email addresses. The default is a semi-colon.
-
contentType
public String contentType
-
from
public String from
-
messageTemplate
public String messageTemplate
-
password
public String password
-
replyTo
public String replyTo
-
server
public String server
-
subjectTemplate
public String subjectTemplate
-
mailEnabled
public boolean mailEnabled
-
useSSL
public boolean useSSL
-
port
public int port
-
starttls
public boolean starttls
-
username
public String username
-
-
Method Detail
-
setUsername
public MailEnvironment setUsername(String username)
-
setEnabled
public MailEnvironment setEnabled(boolean enabled)
-
setFrom
public MailEnvironment setFrom(String from) throws javax.mail.internet.AddressException
- Throws:
javax.mail.internet.AddressException
-
setReplyTo
public MailEnvironment setReplyTo(String replyTo) throws javax.mail.internet.AddressException
- Throws:
javax.mail.internet.AddressException
-
setServer
public MailEnvironment setServer(String server)
-
setPassword
public MailEnvironment setPassword(String password)
-
setPort
public MailEnvironment setPort(int port)
-
useSSL
public MailEnvironment useSSL(boolean useSSL)
-
setDebug
public MailEnvironment setDebug(boolean debugOn)
-
startTLS
public MailEnvironment startTLS(boolean starttls)
-
setSubject
public MailEnvironment setSubject(String subject)
-
setContentType
public MailEnvironment setContentType(String contentType)
-
setMessage
public MailEnvironment setMessage(String message)
-
setRecipients
public MailEnvironment setRecipients(String recipients) throws javax.mail.internet.AddressException
- Throws:
javax.mail.internet.AddressException
-
setRecipients
public MailEnvironment setRecipients(List<String> recipients) throws javax.mail.internet.AddressException
- Throws:
javax.mail.internet.AddressException
-
setCC
public MailEnvironment setCC(String cc) throws javax.mail.internet.AddressException
- Throws:
javax.mail.internet.AddressException
-
setCC
public MailEnvironment setCC(List<String> cc) throws javax.mail.internet.AddressException
- Throws:
javax.mail.internet.AddressException
-
setBCC
public MailEnvironment setBCC(String bcc) throws javax.mail.internet.AddressException
- Throws:
javax.mail.internet.AddressException
-
setBCC
public MailEnvironment setBCC(List<String> bcc) throws javax.mail.internet.AddressException
- Throws:
javax.mail.internet.AddressException
-
create
public static MailEnvironment create()
-
update
public void update(MailEnvironment otherME)
Take- Parameters:
otherME
-
-
parseRecipients
public List<String> parseRecipients(String x) throws javax.mail.internet.AddressException
- Throws:
javax.mail.internet.AddressException
-
setSSLProperties
public int setSSLProperties(Properties props)
Configure aProperties
object using the current environment, returning the port. This is for the option thatuseSSL
is true.- Parameters:
props
-- Returns:
-
setTLSProperties
public int setTLSProperties(Properties props)
Configure aProperties
object using the current environment, returning the port. This is for the option thatstarttls
is true.- Parameters:
props
-- Returns:
-
setSMTPProperties
public int setSMTPProperties(Properties props)
Configure aProperties
object using the current environment, returning the port. In this case, neither SSL nor TLS are used.- Parameters:
props
-
-
-