public class MailServerImpl extends Object implements MailServer
MailServer
implementation that sends email via the configured SMTP server.Modifier and Type | Field and Description |
---|---|
protected Debug |
debug |
static String |
FROM_ADDRESS |
static String |
MESSAGE |
static String |
SERVICE_NAME |
static String |
SERVICE_VERSION |
static String |
SMTP_HOSTNAME |
static String |
SMTP_HOSTPORT |
static String |
SMTP_SSL_ENABLED |
static String |
SMTP_USERNAME |
static String |
SMTP_USERPASSWORD |
static String |
SUBJECT |
Constructor and Description |
---|
MailServerImpl(ServiceConfigManager mgr,
ServiceConfig scm,
Debug debug,
AMSendMail sendMail,
Map<String,Set<String>> options)
Constructor used for testing
|
MailServerImpl(String realm)
Default Constructor
|
Modifier and Type | Method and Description |
---|---|
String |
getMessage() |
String |
getSubject() |
void |
sendEmail(String to,
String subject,
String message)
Sends an email message using default MailServer settings
|
void |
sendEmail(String to,
String subject,
String message,
String mimeType)
Sends an email message using default MailServer settings.
|
void |
sendEmail(String from,
String to,
String subject,
String message,
Map<String,Set<String>> options)
Sends an email message using specified
options given for the MailServer settings
|
void |
sendHtmlEmail(String to,
String subject,
String message)
Sends an email message, containing HTML, using default MailServer settings.
|
void |
sendHtmlEmail(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.
|
protected Debug debug
public static final String SMTP_HOSTNAME
public static final String SMTP_HOSTPORT
public static final String SMTP_USERNAME
public static final String SMTP_USERPASSWORD
public static final String SMTP_SSL_ENABLED
public static final String FROM_ADDRESS
public static final String SUBJECT
public static final String MESSAGE
public static final String SERVICE_NAME
public static final String SERVICE_VERSION
public MailServerImpl(String realm)
realm
- in which emails service shall be createdpublic MailServerImpl(ServiceConfigManager mgr, ServiceConfig scm, Debug debug, AMSendMail sendMail, Map<String,Set<String>> options)
mgr
- Service Configuration Managerscm
- Service Configuration of the email servicedebug
- Debug instance to provide useful debugging informationsendMail
- AMSendmail instance needed for testingoptions
- SMTP Optionspublic String getSubject()
public String getMessage()
public void sendHtmlEmail(String to, String subject, String message) throws javax.mail.MessagingException
MailServer
sendHtmlEmail
in interface MailServer
to
- The address that the E-mail message is sent.subject
- The E-mail subject.message
- The content contained in the E-mail message.javax.mail.MessagingException
- in the case where the module was unable to send the e-mail.public void sendHtmlEmail(String from, String to, String subject, String message, Map<String,Set<String>> options) throws javax.mail.MessagingException
MailServer
sendHtmlEmail
in interface MailServer
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.javax.mail.MessagingException
- in case where the module was unable to send the e-mail.public void sendEmail(String to, String subject, String message, String mimeType) throws javax.mail.MessagingException
MailServer
sendEmail
in interface MailServer
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 emailjavax.mail.MessagingException
- in the case where the module was unable to send the emailpublic void sendEmail(String to, String subject, String message) throws javax.mail.MessagingException
MailServer
sendEmail
in interface MailServer
to
- The address that the E-mail message is sentsubject
- The E-mail subjectmessage
- The content contained in the E-mail messagejavax.mail.MessagingException
- in the case where the module was unable to send the e-mailpublic void sendEmail(String from, String to, String subject, String message, Map<String,Set<String>> options) throws javax.mail.MessagingException
MailServer
sendEmail
in interface MailServer
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, SMTPUserPasswordjavax.mail.MessagingException
- in case where the module was unable to send the e-mailCopyright © 2010–2025 Open Identity Platform Community. All rights reserved.