Package org.exoplatform.services.mail
Interface MailService
-
- All Known Implementing Classes:
MailServiceImpl
public interface MailServiceInterface provides basic operations for sending mail messages and mail service configuration data retrieval. Defines synchronous and asynchronous methods responsible for sending mail message. They can receive parameters of different types to create a mail send. You can passMessage,MimeMessageor specify mail message data explicitly via String parameters.- Since:
- Oct 13, 2004
- Version:
- $Id: MailService.java 5332 2006-04-29 18:32:44Z geaz $
- Author:
- Tuan Nguyen (tuan08@users.sourceforge.net)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description javax.mail.SessiongetMailSession()ProvidesSessioninstance, which is to be used throughoutMailServicemethodsStringgetOutgoingMailServer()Provides outgoing server information, which is basically its hostname or ip address.voidsendMessage(String from, String to, String subject, String body)Sends mail message based on passedStringparameters.voidsendMessage(javax.mail.internet.MimeMessage message)Sends mail message based onMimeMessageinstancevoidsendMessage(Message message)Sends mail message based onMessageinstanceFuture<Boolean>sendMessageInFuture(String from, String to, String subject, String body)Asynchronous variant ofsendMessage(String, String, String, String).Future<Boolean>sendMessageInFuture(javax.mail.internet.MimeMessage message)Asynchronous variant ofsendMessage(MimeMessage).Future<Boolean>sendMessageInFuture(Message message)Asynchronous variant ofsendMessage(Message).
-
-
-
Method Detail
-
getMailSession
javax.mail.Session getMailSession()
ProvidesSessioninstance, which is to be used throughoutMailServicemethods- Returns:
Session
-
getOutgoingMailServer
String getOutgoingMailServer()
Provides outgoing server information, which is basically its hostname or ip address. This server is used as transceiver for mail messages.MailServiceshould send message to the server first and than server will resend messages to the receivers.- Returns:
-
sendMessage
void sendMessage(String from, String to, String subject, String body) throws Exception
Sends mail message based on passedStringparameters.- Parameters:
from- -Stringidentificator of mail sender. For example 'test.sender@test.test'to- -Stringidentificator of mail receiver. For example 'test.receiver@test.test'subject- -Stringsubject of mail messagebody- -Stringcontents of mail message- Throws:
Exception- is thrown if something's gone wrong during mail send procedure
-
sendMessage
void sendMessage(Message message) throws Exception
Sends mail message based onMessageinstance
-
sendMessage
void sendMessage(javax.mail.internet.MimeMessage message) throws ExceptionSends mail message based onMimeMessageinstance- Parameters:
message- -MimeMessageprovides mail message related data (e.g. subject, content etc.)- Throws:
Exception- is thrown if something's gone wrong during mail send procedure
-
sendMessageInFuture
Future<Boolean> sendMessageInFuture(String from, String to, String subject, String body)
Asynchronous variant ofsendMessage(String, String, String, String). ReturnsFutureobject, which allows to track mail sending result. CallingFuture.get()for this object returnsBoolean.TRUEif mail is sent successfully, throwsExecutionExceptionif some exception occured during mail sending. CallingThrowable.getCause()for the thrown exception object provides the exception, which indeed occured during sending mail.- Parameters:
from- -Stringidentificator of mail sender. For example 'test.sender@test.test'to- -Stringidentificator of mail receiver. For example 'test.receiver@test.test'subject- -Stringsubject of mail messagebody- -Stringcontents of mail message- Returns:
Futureobject to watch the result of asynchronous calculation
-
sendMessageInFuture
Future<Boolean> sendMessageInFuture(Message message)
Asynchronous variant ofsendMessage(Message). ReturnsFutureobject, which allows to track mail sending result. CallingFuture.get()for this object returnsBoolean.TRUEif mail is sent successfully, throwsExecutionExceptionif some exception occured during mail sending. CallingThrowable.getCause()for the thrown exception object provides the exception, which indeed occured during sending mail.
-
sendMessageInFuture
Future<Boolean> sendMessageInFuture(javax.mail.internet.MimeMessage message)
Asynchronous variant ofsendMessage(MimeMessage). ReturnsFutureobject, which allows to track mail sending result. CallingFuture.get()for this object returnsBoolean.TRUEif mail is sent successfully, throwsExecutionExceptionif some exception occured during mail sending. CallingThrowable.getCause()for the thrown exception object provides the exception, which indeed occured during sending mail.- Parameters:
message- -MimeMessageprovides mail message related data (e.g. subject, content etc.)- Returns:
Futureobject to watch the result of asynchronous calculation
-
-