Package de.aristaflow.adept2.base.mail
Class EmailToolkit
- java.lang.Object
-
- de.aristaflow.adept2.base.mail.EmailToolkit
-
@Deprecated public class EmailToolkit extends Object
Deprecated.Usecore.mailservice.MailService
orbase.mailservice.MailService
instead.This class contains some methods for sending e-mails. The methods could be used either for system messages or in activities that need mail support.- Author:
- Marco Waimer
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONNECTION_TIMEOUT
Deprecated.The attribute key for the socket connection timeout in milliseconds.static String
SOCKET_FACTORY
Deprecated.The attribute key for the socket factory class.static String
TIMEOUT
Deprecated.The attribute key for the socket read timeout in milliseconds.static String
WRITE_TIMEOUT
Deprecated.The attribute key for the socket write timeout in milliseconds.
-
Constructor Summary
Constructors Constructor Description EmailToolkit()
Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
checkException(Throwable t)
Deprecated.If the given Throwable or one of its causes is either aConnectException
or anUnknownHostException
, this method will return true, to indicate, that there may be a temporary problem with sending emails and that it is worth to retry.static SerialisedEmail
sendMail(String from, String[] to, String[] cc, String[] bcc, String subject, String body, List<SerialisableAttachment> attachments, String hostname)
Deprecated.This method allows the usage of a host differing from the default host.static SerialisedEmail
sendMail(String from, String[] to, String[] cc, String[] bcc, String subject, String body, List<SerialisableAttachment> attachments, String hostname, int hostport, boolean useTLS, boolean useSSL, boolean overtrustful)
Deprecated.This method allows the usage of a host differing from the default host.static SerialisedEmail
sendMail(String from, String[] to, String[] cc, String[] bcc, String subject, String body, List<SerialisableAttachment> attachments, String hostname, int hostport, String username, String password, boolean useTLS, boolean useSSL, boolean overtrustful)
Deprecated.This method allows the usage of a host differing from the default host that also needs a username and a password.static SerialisedEmail
sendMail(String from, String[] to, String[] cc, String[] bcc, String subject, String body, List<SerialisableAttachment> attachments, String hostname, int hostport, String username, String password, boolean useTLS, boolean useSSL, boolean overtrustful, Map<String,String> addAttributes)
Deprecated.This method allows the usage of a host differing from the default host that also needs a username and a password.
-
-
-
Field Detail
-
CONNECTION_TIMEOUT
public static final String CONNECTION_TIMEOUT
Deprecated.The attribute key for the socket connection timeout in milliseconds.- See Also:
- Constant Field Values
-
TIMEOUT
public static final String TIMEOUT
Deprecated.The attribute key for the socket read timeout in milliseconds.- See Also:
- Constant Field Values
-
WRITE_TIMEOUT
public static final String WRITE_TIMEOUT
Deprecated.The attribute key for the socket write timeout in milliseconds.- See Also:
- Constant Field Values
-
SOCKET_FACTORY
public static final String SOCKET_FACTORY
Deprecated.The attribute key for the socket factory class.- See Also:
- Constant Field Values
-
-
Method Detail
-
sendMail
public static SerialisedEmail sendMail(String from, String[] to, String[] cc, String[] bcc, String subject, String body, List<SerialisableAttachment> attachments, String hostname)
Deprecated.This method allows the usage of a host differing from the default host.- Parameters:
from
- The e-mail-address of the sender of the message. If NULL is provided a system default sender will be used.to
- The list of addresses the e-mail should be sent to. At least one recipient has to be provided.cc
- The list of addresses the e-mail should be sent to as 'CC'. NULL is interpreted as no further recipients.bcc
- The list of addresses the e-mail should be sent to as 'BCC'. NULL is interpreted as no further recipients.subject
- The subject of the e-mail.body
- The body text of the e-mail.attachments
- The attachments for the e-mail.null
will be accepted as no attachments.hostname
- The hostname of the mail system the e-mail should be sent via. Ifnull
is provided a system default host will be used.- Returns:
- The sent email message for further usage.
- Throws:
InternalServiceException
- If an error occurs during creating, sending or serialising the e-mail, anInternalServiceException
will be thrown
-
sendMail
public static SerialisedEmail sendMail(String from, String[] to, String[] cc, String[] bcc, String subject, String body, List<SerialisableAttachment> attachments, String hostname, int hostport, boolean useTLS, boolean useSSL, boolean overtrustful)
Deprecated.This method allows the usage of a host differing from the default host.- Parameters:
from
- The e-mail-address of the sender of the message. If NULL is provided a system default sender will be used.to
- The list of addresses the e-mail should be sent to. At least one recipient has to be provided.cc
- The list of addresses the e-mail should be sent to as 'CC'. NULL is interpreted as no further recipients.bcc
- The list of addresses the e-mail should be sent to as 'BCC'. NULL is interpreted as no further recipients.subject
- The subject of the e-mail.body
- The body text of the e-mail.attachments
- The attachments for the e-mail. NULL will be accepted as no attachments.hostname
- The hostname of the mail system the e-mail should be sent via. If NULL is provided a system default host will be used.hostport
- The smtp port of the mail system the e-mail should be sent via. If 0 is provided the default port 25 will be used.useTLS
- Whether TLS should be used.useSSL
- Whether SSL encryption should be used.overtrustful
- Whether every certificate will be trusted.- Returns:
- The sent email message for further usage.
- Throws:
InternalServiceException
- If an error occurs during creating, sending or serialising the e-mail, anInternalServiceException
will be thrown
-
sendMail
public static SerialisedEmail sendMail(String from, String[] to, String[] cc, String[] bcc, String subject, String body, List<SerialisableAttachment> attachments, String hostname, int hostport, String username, String password, boolean useTLS, boolean useSSL, boolean overtrustful)
Deprecated.This method allows the usage of a host differing from the default host that also needs a username and a password.- Parameters:
from
- The e-mail-address of the sender of the message. If NULL is provided a system default sender will be used.to
- The list of addresses the e-mail should be sent to. At least one recipient has to be provided.cc
- The list of addresses the e-mail should be sent to as 'CC'. NULL is interpreted as no further recipients.bcc
- The list of addresses the e-mail should be sent to as 'BCC'. NULL is interpreted as no further recipients.subject
- The subject of the e-mail.body
- The body text of the e-mail.attachments
- The attachments for the e-mail. NULL will be accepted as no attachments.hostname
- The hostname of the mail system the e-mail should be sent via. If NULL is provided a system default host will be used.hostport
- The smtp port of the mail system the e-mail should be sent via. If 0 is provided the default port 25 will be used.username
- The username that is needed to authenticate on the smtp-server. NULL means, that no authentication is needed.password
- The password that is needed to authenticate on the smtp-server. NULL means, that no authentication is needed.useTLS
- Whether TLS should be used.useSSL
- Whether SSL encryption should be used.overtrustful
- Whether every certificate will be trusted.- Returns:
- The sent email message for further usage.
- Throws:
InternalServiceException
- If an error occurs during creating, sending or serialising the e-mail, anInternalServiceException
will be thrown
-
sendMail
public static SerialisedEmail sendMail(String from, String[] to, String[] cc, String[] bcc, String subject, String body, List<SerialisableAttachment> attachments, String hostname, int hostport, String username, String password, boolean useTLS, boolean useSSL, boolean overtrustful, Map<String,String> addAttributes)
Deprecated.This method allows the usage of a host differing from the default host that also needs a username and a password.
The additional attributes could be used e.g. to embed images in a html message.NOTE: This method actually sends the e-mail.
- Parameters:
from
- The e-mail-address of the sender of the message. If NULL is provided a system default sender will be used.to
- The list of addresses the e-mail should be sent to. At least one recipient has to be provided.cc
- The list of addresses the e-mail should be sent to as 'CC'. NULL is interpreted as no further recipients.bcc
- The list of addresses the e-mail should be sent to as 'BCC'. NULL is interpreted as no further recipients.subject
- The subject of the e-mail.body
- The body text of the e-mail.attachments
- The attachments for the e-mail. NULL will be accepted as no attachments.hostname
- The hostname of the mail system the e-mail should be sent via. If NULL is provided a system default host will be used.hostport
- The smtp port of the mail system the e-mail should be sent via. If 0 is provided the default port 25 will be used.username
- The username that is needed to authenticate on the smtp-server. NULL means, that no authentication is needed.password
- The password that is needed to authenticate on the smtp-server. NULL means, that no authentication is needed.useTLS
- Whether TLS should be used.useSSL
- Whether SSL encryption should be used.overtrustful
- Whether every certificate will be trusted.addAttributes
- A map of additional attributes that could be used for the e-mail.- Returns:
- The sent email message for further usage.
- Throws:
InternalServiceException
- If an error occurs during creating, sending or serialising the e-mail, anInternalServiceException
will be thrown
-
checkException
public static boolean checkException(Throwable t)
Deprecated.If the given Throwable or one of its causes is either aConnectException
or anUnknownHostException
, this method will return true, to indicate, that there may be a temporary problem with sending emails and that it is worth to retry.- Parameters:
t
- The Throwable that should be checked.- Returns:
- True, if the sending of the email may be successful when retrying after some time.
-
-