Class MailManagerImpl

java.lang.Object
com.atlassian.crowd.manager.mail.MailManagerImpl
All Implemented Interfaces:
MailConfigurationService, MailManager

public class MailManagerImpl extends Object implements MailManager
  • Field Details

  • Constructor Details

  • Method Details

    • sendHtmlEmail

      public void sendHtmlEmail(javax.mail.internet.InternetAddress emailAddress, String subject, String body, String plainText) throws MailSendException
      Description copied from interface: MailManager
      Sends an HTML email using the configured mail server (remote host / JNDI).
      Specified by:
      sendHtmlEmail in interface MailManager
      Parameters:
      emailAddress - address of recipient.
      subject - subject header. Will be appended with the configured mail subject prefix in the final email.
      body - email body html.
      plainText - plainText alternative to the html body text specified in body
      Throws:
      MailSendException - an error occurred sending the email.
    • sendPlainTextEmail

      public void sendPlainTextEmail(javax.mail.internet.InternetAddress emailAddress, String subject, String body) throws MailSendException
      Description copied from interface: MailManager
      Sends an email using the configured mail server (remote host / JNDI).
      Specified by:
      sendPlainTextEmail in interface MailManager
      Parameters:
      emailAddress - address of recipient.
      subject - subject header. Will be appended with the configured mail subject prefix in the final email.
      body - email body text.
      Throws:
      MailSendException - an error occurred sending the email.
    • sendPlainTextEmail

      public void sendPlainTextEmail(javax.mail.internet.InternetAddress emailAddress, String subject, String body, Map<String,String> headers, Map<String,javax.activation.DataSource> attachments) throws MailSendException
      Description copied from interface: MailManager
      Sends an email with zero or more attachments and headers using the configured mail server (remote host / JNDI).
      Specified by:
      sendPlainTextEmail in interface MailManager
      Parameters:
      emailAddress - address of recipient.
      subject - subject header. Will be appended with the configured mail subject prefix in the final email.
      body - email body text.
      headers - custom headers to add.
      attachments - [displayed filename]->[data] mapping for attachments.
      Throws:
      MailSendException - an error occurred sending the email.
    • sendTestMail

      public SendTestMailResult sendTestMail(SMTPServer smtpServer, javax.mail.internet.InternetAddress emailAddress) throws MailSendException
      Description copied from interface: MailManager
      Send a test email using the supplied mail server (remote host / JNDI)
      Specified by:
      sendTestMail in interface MailManager
      Parameters:
      smtpServer - supplied SMTP Server, which will be used to send message.
      emailAddress - address of recipient.
      Returns:
      result of test, which contains logs and status.
      Throws:
      MailSendException - an error occurred sending the email.
    • sendEmails

      public Set<? extends EmailMessage> sendEmails(Collection<? extends EmailMessage> messagesToSend) throws MailSendException
      Description copied from interface: MailManager
      Sends multiple emails using the configured mail server.
      Specified by:
      sendEmails in interface MailManager
      Returns:
      a collection of messages that failed to be sent
      Throws:
      MailSendException - an error occurred that prevented sending any email (connection error, configuration error, etc.).
    • sendEmail

      public void sendEmail(EmailMessage messageToSend) throws MailSendException
      Description copied from interface: MailManager
      Sends a single email using the configured mail server
      Specified by:
      sendEmail in interface MailManager
      Parameters:
      messageToSend - single email using the configured mail server
      Throws:
      MailSendException - an error occurred sending the email.
    • validateConfiguration

      public List<ValidationError> validateConfiguration(MailConfiguration mailServerEntity)
      Description copied from interface: MailManager
      Verifies whether the specified MailConfiguration is valid
      Specified by:
      validateConfiguration in interface MailManager
      Parameters:
      mailServerEntity - entity with attributes to be validated
      Returns:
      a list with errors found in the configuration
    • saveConfiguration

      public void saveConfiguration(MailConfiguration mailConfiguration)
      Description copied from interface: MailManager
      Sets the new mail configuration
      Specified by:
      saveConfiguration in interface MailConfigurationService
      Specified by:
      saveConfiguration in interface MailManager
      Parameters:
      mailConfiguration - new configuration
    • getMailConfiguration

      public MailConfiguration getMailConfiguration()
      Description copied from interface: MailManager
      Returns current mail configuration
      Specified by:
      getMailConfiguration in interface MailConfigurationService
      Specified by:
      getMailConfiguration in interface MailManager
      Returns:
      Mail configuration
    • removePasswordFromLogs

      protected String removePasswordFromLogs(String logs)
    • isConfigured

      public boolean isConfigured()
      Specified by:
      isConfigured in interface MailConfigurationService
      Specified by:
      isConfigured in interface MailManager
      Returns:
      true if the mail server is fully configured (does not check if the configuration is correct)