public class SFSPostOffice extends java.lang.Object implements IMailerService
IMailerService which is provided by the SmartFoxServer class-
This service provides a simple mailing service capable of sending text and html emails via
a configured SMTP service. SMPT ports supported are 25, 587 and 465 (SSL). The service can be configured via
the SFS2X AdminTool GUI.
You can obtain access to the service via the following line of code:
SmartFoxServer.getInstance().getMailService();
In order to ensure proper communication between SmartFoxServer and the SMTP server we make sure to double check your hosting firewall settings and make sure traffic is allowed on the chosen port.
There are three modalities for sending an email:
| Constructor and Description |
|---|
SFSPostOffice() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy(java.lang.Object o)
Destroy service
|
com.smartfoxserver.v2.config.MailerSettings |
getConfiguration()
Obtain the configuration settings of the service
|
java.lang.String |
getName()
Get the service name
|
void |
handleMessage(java.lang.Object message)
Send message to service
|
void |
init(java.lang.Object o)
Initialize service
|
void |
sendMail(Email email)
Sends the email to the recipient, or list of recipients, specified in the Email argument.
|
void |
sendMail(Email email,
IMailerCallbackHandler callBack)
Sends the email to the recipient, or list of recipients, specified in the Email argument and get an asynchronous event when
the email is delivered.
|
void |
sendMail(Email email,
IMailerCallbackHandler callBack,
int delaySeconds)
Sends an email in the future.
|
void |
setName(java.lang.String name)
Set the service name
|
public void init(java.lang.Object o)
com.smartfoxserver.bitswarm.service.IServiceinit in interface com.smartfoxserver.bitswarm.service.IServiceo - custom parameterspublic void destroy(java.lang.Object o)
com.smartfoxserver.bitswarm.service.IServicedestroy in interface com.smartfoxserver.bitswarm.service.IServiceo - custom parameterspublic java.lang.String getName()
com.smartfoxserver.bitswarm.service.IServicegetName in interface com.smartfoxserver.bitswarm.service.IServicepublic com.smartfoxserver.v2.config.MailerSettings getConfiguration()
getConfiguration in interface IMailerServicepublic void sendMail(Email email, IMailerCallbackHandler callBack) throws javax.mail.MessagingException
In order to send an email to multiple recipients the Email toAddress should contain comma-separated (and valid) email addresses. Don't use any blank spaces in the separation of each address.
NOTE: Sending emails requires to add the mailapi.jar (found under SFS2X/lib/) to your project's libraries.
sendMail in interface IMailerServiceemail - the email to sendcallBack - the callback handler, if null no event will be firedjavax.mail.MessagingException - an error might be caused by malformed email addresses either in the TO or FROM fieldsSFSEmailpublic void sendMail(Email email) throws javax.mail.MessagingException
In order to send an email to multiple recipients the Email toAddress should contain comma-separated (and valid) email addresses. Don't use any blank spaces in the separation of each address.
NOTE: Sending emails requires to add the mailapi.jar (found under SFS2X/lib/) to your project's libraries.
sendMail in interface IMailerServiceemail - the email to sendjavax.mail.MessagingException - an error might be caused by malformed email addresses either in the TO or FROM fieldsSFSEmailpublic void sendMail(Email email, IMailerCallbackHandler callBack, int delaySeconds) throws javax.mail.MessagingException
In order to send an email to multiple recipients the Email toAddress should contain comma-separated (and valid) email addresses. Don't use any blank spaces in the separation of each address.
NOTE: Sending emails requires to add the mailapi.jar (found under SFS2X/lib/) to your project's libraries.
sendMail in interface IMailerServiceemail - the email to sendcallBack - the callback handler, if null no event will be fireddelaySeconds - the amount of seconds to wait before sendint the mailjavax.mail.MessagingException - an error might be caused by malformed email addresses either in the TO or FROM fieldsSFSEmailpublic void handleMessage(java.lang.Object message)
com.smartfoxserver.bitswarm.service.IServicehandleMessage in interface com.smartfoxserver.bitswarm.service.IServicemessage - the messagepublic void setName(java.lang.String name)
com.smartfoxserver.bitswarm.service.IServicesetName in interface com.smartfoxserver.bitswarm.service.IServicename - the service name