public interface MailService
Message, MimeMessage
or specify mail message data explicitly via String parameters.| Modifier and Type | Method and Description |
|---|---|
javax.mail.Session |
getMailSession()
Provides
Session instance, which is to be used throughout MailService methods |
String |
getOutgoingMailServer()
Provides outgoing server information, which is basically its hostname or ip address.
|
void |
sendMessage(Message message)
Sends mail message based on
Message instance |
void |
sendMessage(javax.mail.internet.MimeMessage message)
Sends mail message based on
MimeMessage instance |
void |
sendMessage(String from,
String to,
String subject,
String body)
Sends mail message based on passed
String parameters. |
Future<Boolean> |
sendMessageInFuture(Message message)
Asynchronous variant of
sendMessage(Message). |
Future<Boolean> |
sendMessageInFuture(javax.mail.internet.MimeMessage message)
Asynchronous variant of
sendMessage(MimeMessage). |
Future<Boolean> |
sendMessageInFuture(String from,
String to,
String subject,
String body)
Asynchronous variant of
sendMessage(String, String, String, String). |
javax.mail.Session getMailSession()
Session instance, which is to be used throughout MailService methodsSessionString getOutgoingMailServer()
MailService should send message
to the server first and than server will resend messages to the receivers.void sendMessage(String from, String to, String subject, String body) throws Exception
String parameters.from - - String identificator of mail sender. For example 'test.sender@test.test'to - - String identificator of mail receiver. For example 'test.receiver@test.test'subject - - String subject of mail messagebody - - String contents of mail messageException - is thrown if something's gone wrong during mail send procedurevoid sendMessage(Message message) throws Exception
Message instancevoid sendMessage(javax.mail.internet.MimeMessage message)
throws Exception
MimeMessage instancemessage - - MimeMessage provides mail message related data (e.g. subject, content etc.)Exception - is thrown if something's gone wrong during mail send procedureFuture<Boolean> sendMessageInFuture(String from, String to, String subject, String body)
sendMessage(String, String, String, String).
Returns Future object, which allows to track mail sending result. Calling Future.get()
for this object returns Boolean.TRUE if mail is sent successfully,
throws ExecutionException if some exception occured during mail sending.
Calling Throwable.getCause() for the thrown exception object provides the exception,
which indeed occured during sending mail.from - - String identificator of mail sender. For example 'test.sender@test.test'to - - String identificator of mail receiver. For example 'test.receiver@test.test'subject - - String subject of mail messagebody - - String contents of mail messageFuture object to watch the result of asynchronous calculationFuture<Boolean> sendMessageInFuture(Message message)
sendMessage(Message).
Returns Future object, which allows to track mail sending result. Calling Future.get()
for this object returns Boolean.TRUE if mail is sent successfully,
throws ExecutionException if some exception occured during mail sending.
Calling Throwable.getCause() for the thrown exception object provides the exception,
which indeed occured during sending mail.Future<Boolean> sendMessageInFuture(javax.mail.internet.MimeMessage message)
sendMessage(MimeMessage).
Returns Future object, which allows to track mail sending result. Calling Future.get()
for this object returns Boolean.TRUE if mail is sent successfully,
throws ExecutionException if some exception occured during mail sending.
Calling Throwable.getCause() for the thrown exception object provides the exception,
which indeed occured during sending mail.message - - MimeMessage provides mail message related data (e.g. subject, content etc.)Future object to watch the result of asynchronous calculationCopyright © 2019 eXo Platform SAS. All Rights Reserved.