public class MailConfigurationServiceImpl extends Object implements MailConfigurationService
MailConfigurationService.MailMode
Constructor and Description |
---|
MailConfigurationServiceImpl(SecretEncryptionService secretEncryptionService,
BambooPermissionManager bambooPermissionManager,
com.atlassian.struts.TextProvider textProvider) |
Modifier and Type | Method and Description |
---|---|
void |
deleteMailServer()
Delete the current mail server configuration
|
com.atlassian.mail.server.SMTPMailServer |
getMailServer()
Retrieve the current mail server configuration
|
boolean |
isMailServerConfigured()
Returns true if mail server configuration exists
|
com.atlassian.mail.server.SMTPMailServer |
updateMailServer(String name,
String fromAddress,
String subjectPrefix,
Boolean precedenceBulkHeaderExcluded,
MailConfigurationService.MailMode emailSetting,
String smtpServer,
String smtpPort,
String smtpUsername,
String smtpPassword,
Boolean tlsEnabled,
String jndiLocation)
Update the current mail server configuration
|
com.atlassian.mail.server.SMTPMailServer |
updateMailServer(String name,
String fromAddress,
String subjectPrefix,
Boolean precedenceBulkHeaderExcluded,
String emailSetting,
String smtpServer,
String smtpPort,
String smtpUsername,
String smtpPassword,
Boolean tlsEnabled,
String jndiLocation)
Update the current mail server configuration
|
List<String> |
validateJndiLocation(String jndiName)
Validates JNDI location for mail server.
|
@Autowired public MailConfigurationServiceImpl(@Lazy SecretEncryptionService secretEncryptionService, BambooPermissionManager bambooPermissionManager, com.atlassian.struts.TextProvider textProvider)
public boolean isMailServerConfigured() throws UnauthorisedException
MailConfigurationService
isMailServerConfigured
in interface MailConfigurationService
UnauthorisedException
- if user does not have appropriate permissions (System Administrator)@NotNull public com.atlassian.mail.server.SMTPMailServer getMailServer() throws UnauthorisedException, NotFoundException
MailConfigurationService
getMailServer
in interface MailConfigurationService
UnauthorisedException
- if user does not have appropriate permissions (System Administrator)NotFoundException
- if no mail server configuration is set@NotNull public com.atlassian.mail.server.SMTPMailServer updateMailServer(@Nullable String name, @Nullable String fromAddress, @Nullable String subjectPrefix, @Nullable Boolean precedenceBulkHeaderExcluded, @Nullable String emailSetting, @Nullable String smtpServer, @Nullable String smtpPort, @Nullable String smtpUsername, @Nullable String smtpPassword, @Nullable Boolean tlsEnabled, @Nullable String jndiLocation) throws WebValidationException, UnauthorisedException
MailConfigurationService
updateMailServer
in interface MailConfigurationService
name
- name of the email serverfromAddress
- an email address Bamboo-generated emails are sent from, must be a valid email
addresssubjectPrefix
- prefix added to the email subjectprecedenceBulkHeaderExcluded
- whether to exclude "precedence:bulk" email headeremailSetting
- must be either "JNDI" or "SMTP"smtpServer
- address of SMTP server, null
for "JDNI"smtpPort
- port of SMTP server, null
for "JNDI"smtpUsername
- user name, null
for "JNDI"smtpPassword
- password, null
for "JNDI"tlsEnabled
- whether TLS is enabled, null
for "JNDI"jndiLocation
- JNDI address specyfing email server, null
for "SMTP"WebValidationException
- if the supplied parameters are invalidUnauthorisedException
- if user does not have appropriate permissions (System Administrator)@NotNull public com.atlassian.mail.server.SMTPMailServer updateMailServer(@Nullable String name, @Nullable String fromAddress, @Nullable String subjectPrefix, @Nullable Boolean precedenceBulkHeaderExcluded, @Nullable MailConfigurationService.MailMode emailSetting, @Nullable String smtpServer, @Nullable String smtpPort, @Nullable String smtpUsername, @Nullable String smtpPassword, @Nullable Boolean tlsEnabled, @Nullable String jndiLocation) throws WebValidationException, UnauthorisedException
MailConfigurationService
updateMailServer
in interface MailConfigurationService
name
- name of the email serverfromAddress
- an email address Bamboo-generated emails are sent from, must be a valid email
addresssubjectPrefix
- prefix added to the email subjectprecedenceBulkHeaderExcluded
- whether to exclude "precedence:bulk" email headeremailSetting
- MailMode.JNDI or MailMode.SMTPsmtpServer
- address of SMTP server, null
for JDNIsmtpPort
- port of SMTP server, null
for JNDIsmtpUsername
- user name, null
for JNDIsmtpPassword
- password, null
for JNDItlsEnabled
- whether TLS is enabled, null
for JNDIjndiLocation
- JNDI address specyfing email server, null
for SMTPWebValidationException
- if the supplied parameters are invalidUnauthorisedException
- if user does not have appropriate permissions (System Administrator)public void deleteMailServer() throws NotFoundException, com.atlassian.mail.MailException
MailConfigurationService
deleteMailServer
in interface MailConfigurationService
NotFoundException
- if a mail server is not currently setcom.atlassian.mail.MailException
- if there is an error attempting to delete the current mail configuration@NotNull public List<String> validateJndiLocation(@NotNull String jndiName)
MailConfigurationService
This method will not check whether the server can be found under the given location. Only the validity of the location (e.g. that a supported scheme was used) is checked.
validateJndiLocation
in interface MailConfigurationService
jndiName
- JNDI address specifying email serverCopyright © 2017 Atlassian Software Systems Pty Ltd. All rights reserved.