Class MailServerImpl
- java.lang.Object
-
- org.forgerock.openam.services.email.MailServerImpl
-
- All Implemented Interfaces:
MailServer
public class MailServerImpl extends Object implements MailServer
DefaultMailServerimplementation that sends email via the configured SMTP server.
-
-
Field Summary
Fields Modifier and Type Field Description protected Debugdebugstatic StringFROM_ADDRESSstatic StringMESSAGEstatic StringSERVICE_NAMEstatic StringSERVICE_VERSIONstatic StringSMTP_HOSTNAMEstatic StringSMTP_HOSTPORTstatic StringSMTP_SSL_ENABLEDstatic StringSMTP_USERNAMEstatic StringSMTP_USERPASSWORDstatic StringSUBJECT
-
Constructor Summary
Constructors Constructor Description MailServerImpl(ServiceConfigManager mgr, ServiceConfig scm, Debug debug, AMSendMail sendMail, Map<String,Set<String>> options)Constructor used for testingMailServerImpl(String realm)Default Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetMessage()StringgetSubject()voidsendEmail(String to, String subject, String message)Sends an email message using default MailServer settingsvoidsendEmail(String to, String subject, String message, String mimeType)Sends an email message using default MailServer settings.voidsendEmail(String from, String to, String subject, String message, Map<String,Set<String>> options)Sends an email message using specified options given for the MailServer settingsvoidsendHtmlEmail(String to, String subject, String message)Sends an email message, containing HTML, using default MailServer settings.voidsendHtmlEmail(String from, String to, String subject, String message, Map<String,Set<String>> options)Sends an email message, containing HTML, using specified options given for the MailServer settings.
-
-
-
Field Detail
-
debug
protected Debug debug
-
SMTP_HOSTNAME
public static final String SMTP_HOSTNAME
- See Also:
- Constant Field Values
-
SMTP_HOSTPORT
public static final String SMTP_HOSTPORT
- See Also:
- Constant Field Values
-
SMTP_USERNAME
public static final String SMTP_USERNAME
- See Also:
- Constant Field Values
-
SMTP_USERPASSWORD
public static final String SMTP_USERPASSWORD
- See Also:
- Constant Field Values
-
SMTP_SSL_ENABLED
public static final String SMTP_SSL_ENABLED
- See Also:
- Constant Field Values
-
FROM_ADDRESS
public static final String FROM_ADDRESS
- See Also:
- Constant Field Values
-
SUBJECT
public static final String SUBJECT
- See Also:
- Constant Field Values
-
MESSAGE
public static final String MESSAGE
- See Also:
- Constant Field Values
-
SERVICE_NAME
public static final String SERVICE_NAME
- See Also:
- Constant Field Values
-
SERVICE_VERSION
public static final String SERVICE_VERSION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MailServerImpl
public MailServerImpl(String realm)
Default Constructor- Parameters:
realm- in which emails service shall be created
-
MailServerImpl
public MailServerImpl(ServiceConfigManager mgr, ServiceConfig scm, Debug debug, AMSendMail sendMail, Map<String,Set<String>> options)
Constructor used for testing- Parameters:
mgr- Service Configuration Managerscm- Service Configuration of the email servicedebug- Debug instance to provide useful debugging informationsendMail- AMSendmail instance needed for testingoptions- SMTP Options
-
-
Method Detail
-
getSubject
public String getSubject()
-
getMessage
public String getMessage()
-
sendHtmlEmail
public void sendHtmlEmail(String to, String subject, String message) throws jakarta.mail.MessagingException
Description copied from interface:MailServerSends an email message, containing HTML, using default MailServer settings.- Specified by:
sendHtmlEmailin interfaceMailServer- Parameters:
to- The address that the E-mail message is sent.subject- The E-mail subject.message- The content contained in the E-mail message.- Throws:
jakarta.mail.MessagingException- in the case where the module was unable to send the e-mail.
-
sendHtmlEmail
public void sendHtmlEmail(String from, String to, String subject, String message, Map<String,Set<String>> options) throws jakarta.mail.MessagingException
Description copied from interface:MailServerSends an email message, containing HTML, using specified options given for the MailServer settings.- Specified by:
sendHtmlEmailin interfaceMailServer- Parameters:
from- The address that sends the E-mail message.to- The address that the E-mail message is sent.subject- The E-mail subject.message- The content contained in the E-mail message.options- SMTPHostName, SMTPPort, SMTPUser, SMTPUserPassword.- Throws:
jakarta.mail.MessagingException- in case where the module was unable to send the e-mail.
-
sendEmail
public void sendEmail(String to, String subject, String message, String mimeType) throws jakarta.mail.MessagingException
Description copied from interface:MailServerSends an email message using default MailServer settings.- Specified by:
sendEmailin interfaceMailServer- Parameters:
to- the address that the email message is sentsubject- the E-mail subjectmessage- the content contained in the email messagemimeType- the mime type to be used for the email- Throws:
jakarta.mail.MessagingException- in the case where the module was unable to send the email
-
sendEmail
public void sendEmail(String to, String subject, String message) throws jakarta.mail.MessagingException
Description copied from interface:MailServerSends an email message using default MailServer settings- Specified by:
sendEmailin interfaceMailServer- Parameters:
to- The address that the E-mail message is sentsubject- The E-mail subjectmessage- The content contained in the E-mail message- Throws:
jakarta.mail.MessagingException- in the case where the module was unable to send the e-mail
-
sendEmail
public void sendEmail(String from, String to, String subject, String message, Map<String,Set<String>> options) throws jakarta.mail.MessagingException
Description copied from interface:MailServerSends an email message using specified options given for the MailServer settings- Specified by:
sendEmailin interfaceMailServer- Parameters:
from- The address that sends the E-mail messageto- The address that the E-mail message is sentsubject- The E-mail subjectmessage- The content contained in the E-mail messageoptions- SMTPHostName, SMTPPort, SMTPUser, SMTPUserPassword- Throws:
jakarta.mail.MessagingException- in case where the module was unable to send the e-mail
-
-