Package org.opencastproject.kernel.mail
Class BaseSmtpService
java.lang.Object
org.opencastproject.kernel.mail.BaseSmtpService
- Direct Known Subclasses:
SmtpService
Base implementation that allows to send e-mails using
javax.mail.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe current mail transport protocolprotected static final StringParameter suffix for the authentication settingprotected static final StringParameter name for the debugging settingprotected static final StringParameter name for the recipientprotected static final StringParameter suffix for the mail hostprotected static final StringParameter name for the passwordprotected static final StringParameter suffix for the mail portprotected static final StringParameter prefix common to all "mail" propertiesprotected static final StringParameter suffix for the start tls statusprotected static final StringParameter name for the transport protocolprotected static final StringParameter name for the username -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidjavax.mail.internet.MimeMessageCreates a new message.javax.mail.SessionReturns the default mail session that can be used to create a new message.booleanvoidsend(javax.mail.internet.MimeMessage message) Sendsmessageusing the configured transport.voidsetDebug(boolean debug) voidvoidsetMailTransport(String mailTransport) voidsetPassword(String password) voidvoidsetProductionMode(boolean mode) voidvoidsetSsl(boolean ssl) void
-
Field Details
-
OPT_MAIL_PREFIX
Parameter prefix common to all "mail" properties- See Also:
-
OPT_MAIL_TRANSPORT
Parameter name for the transport protocol- See Also:
-
OPT_MAIL_HOST_SUFFIX
Parameter suffix for the mail host- See Also:
-
OPT_MAIL_PORT_SUFFIX
Parameter suffix for the mail port- See Also:
-
OPT_MAIL_TLS_ENABLE_SUFFIX
Parameter suffix for the start tls status- See Also:
-
OPT_MAIL_AUTH_SUFFIX
Parameter suffix for the authentication setting- See Also:
-
OPT_MAIL_USER
Parameter name for the username- See Also:
-
OPT_MAIL_PASSWORD
Parameter name for the password- See Also:
-
OPT_MAIL_FROM
Parameter name for the recipient- See Also:
-
OPT_MAIL_DEBUG
Parameter name for the debugging setting- See Also:
-
mailTransport
The current mail transport protocol
-
-
Constructor Details
-
BaseSmtpService
public BaseSmtpService()
-
-
Method Details
-
setProductionMode
public void setProductionMode(boolean mode) -
isProductionMode
public boolean isProductionMode() -
setHost
-
setMailTransport
-
setPort
-
setUser
-
setPassword
-
setDebug
public void setDebug(boolean debug) -
setSender
-
getSender
-
setSsl
public void setSsl(boolean ssl) -
configure
public void configure() -
getSession
public javax.mail.Session getSession()Returns the default mail session that can be used to create a new message.- Returns:
- the default mail session
-
createMessage
public javax.mail.internet.MimeMessage createMessage()Creates a new message.- Returns:
- the new message
-
send
public void send(javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException Sendsmessageusing the configured transport.- Parameters:
message- the message- Throws:
javax.mail.MessagingException- if sending the message failed
-