Class MailServiceImpl
java.lang.Object
org.exoplatform.services.mail.impl.MailServiceImpl
- All Implemented Interfaces:
MailService
Basically this is
MailService implementation build on top of javax.mail package.
You may define the behaviour of the service via InitParams, which can
be set in configuration file of the ExoContainer.
Note: To be able to send mails you must provide active SMTP server and mention it in service configuration.
Created by The eXo Platform SAS Author : Phung Hai Nam phunghainam@gmail.com Dec 23, 2005
-
Constructor Summary
ConstructorsConstructorDescriptionMailServiceImpl(org.exoplatform.container.xml.InitParams params, org.exoplatform.container.ExoContainerContext ctx) -
Method Summary
Modifier and TypeMethodDescriptionprotected String[]javax.mail.SessionProvidesSessioninstance, which is to be used throughoutMailServicemethodsProvides 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 onMessageinstancesendMessageInFuture(String from, String to, String subject, String body) Asynchronous variant ofMailService.sendMessage(String, String, String, String).sendMessageInFuture(javax.mail.internet.MimeMessage message) Asynchronous variant ofMailService.sendMessage(MimeMessage).sendMessageInFuture(Message message) Asynchronous variant ofMailService.sendMessage(Message).
-
Constructor Details
-
Method Details
-
getMailSession
public javax.mail.Session getMailSession()ProvidesSessioninstance, which is to be used throughoutMailServicemethods- Specified by:
getMailSessionin interfaceMailService- Returns:
Session
-
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.- Specified by:
getOutgoingMailServerin interfaceMailService- Returns:
-
sendMessage
Sends mail message based on passedStringparameters.- Specified by:
sendMessagein interfaceMailService- 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
Sends mail message based onMessageinstance- Specified by:
sendMessagein interfaceMailService- Parameters:
message- -Messageprovides mail message related data (e.g. subject, content etc.)- Throws:
Exception- is thrown if something's gone wrong during mail send procedure
-
sendMessage
Sends mail message based onMimeMessageinstance- Specified by:
sendMessagein interfaceMailService- 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
Asynchronous variant ofMailService.sendMessage(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.- Specified by:
sendMessageInFuturein interfaceMailService- 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
Asynchronous variant ofMailService.sendMessage(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.- Specified by:
sendMessageInFuturein interfaceMailService- Parameters:
message- -Messageprovides mail message related data (e.g. subject, content etc.)- Returns:
Futureobject to watch the result of asynchronous calculation
-
sendMessageInFuture
Asynchronous variant ofMailService.sendMessage(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.- Specified by:
sendMessageInFuturein interfaceMailService- Parameters:
message- -MimeMessageprovides mail message related data (e.g. subject, content etc.)- Returns:
Futureobject to watch the result of asynchronous calculation
-
getArrs
-