Class SimpleSmtpMailConnection
java.lang.Object
com.aquima.interactions.foundation.connectivity.impl.SimpleSmtpMailConnection
- All Implemented Interfaces:
IConnection
,IMailConnection
This mail connection implementation uses the Simple Mail Transfer Protocol (SMTP) to send email messages.
- Since:
- 6.4
- Author:
- Jon van Leuven
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SimpleSmtpMailConnection
(String name, String smtpHost, int smtpPort, String smtpUser, String smtpPassword, boolean useTLS, String fromAddress, String[] toAddresses, String[] ccAddresses, String[] bccAddresses) This constructor creates a mail connection for a SMTP host, port, username and password, while also specifying the usage of TLS. -
Method Summary
Modifier and TypeMethodDescriptionprotected javax.mail.internet.MimeMessage
createEmailMessage
(IMailMessage message, javax.mail.Session session) String[]
String[]
getName()
This method returns the name of the connection object.String[]
getType()
This method returns the type of the connection object.protected javax.mail.internet.MimeMessage
onBeforeSend
(IMailMessage message, javax.mail.internet.MimeMessage mimeMessage) void
sendMessage
(IMailMessage message) This method sends the email message via this connection.
-
Constructor Details
-
SimpleSmtpMailConnection
protected SimpleSmtpMailConnection(String name, String smtpHost, int smtpPort, String smtpUser, String smtpPassword, boolean useTLS, String fromAddress, String[] toAddresses, String[] ccAddresses, String[] bccAddresses) This constructor creates a mail connection for a SMTP host, port, username and password, while also specifying the usage of TLS. If no username and password is specified, no authentication will be performed.- Parameters:
name
- The unique name for this connection, may not be empty or null.smtpHost
- The host name, may not be empty or null.smtpPort
- must be an integer value between 1 and 65535smtpUser
- The user name for the SMTP host, may be null or empty.smtpPassword
- The password name for the SMTP host, may be null or empty.useTLS
- Indication if TLS is to be used.
-
-
Method Details
-
getName
Description copied from interface:IConnection
This method returns the name of the connection object. The name is used to uniquely identify the connection object.- Specified by:
getName
in interfaceIConnection
- Returns:
- the name of the connection object.
-
getType
Description copied from interface:IConnection
This method returns the type of the connection object.- Specified by:
getType
in interfaceIConnection
- Returns:
- the type of the connection object.
-
sendMessage
Description copied from interface:IMailConnection
This method sends the email message via this connection.- Specified by:
sendMessage
in interfaceIMailConnection
- Parameters:
message
- The email message, may not be null- Throws:
MailSizeExceededException
- Should be thrown when the message size exceeds the mail server storage allocation.
-
getFromAddress
- Specified by:
getFromAddress
in interfaceIMailConnection
-
getToAddresses
- Specified by:
getToAddresses
in interfaceIMailConnection
-
getCcAddresses
- Specified by:
getCcAddresses
in interfaceIMailConnection
-
getBccAddresses
- Specified by:
getBccAddresses
in interfaceIMailConnection
-
createEmailMessage
protected javax.mail.internet.MimeMessage createEmailMessage(IMailMessage message, javax.mail.Session session) throws Exception - Throws:
Exception
-
onBeforeSend
protected javax.mail.internet.MimeMessage onBeforeSend(IMailMessage message, javax.mail.internet.MimeMessage mimeMessage) throws Exception - Throws:
Exception
-