Class SFSPostOffice
- All Implemented Interfaces:
com.smartfoxserver.bitswarm.service.IService,IMailerService
You can access the service via the following line of code:
getApi().getMailService();
In order to ensure proper communication between SmartFoxServer and the SMTP server make sure to double check your hosting firewall settings and verify that traffic is allowed for the specified TCP port.
There are three modes for sending an email:
- No notice send: simply sends the email right away
- Callback send: you provide a callback object that will be invoked once the email has been delivered. The callback notifies either the success of the operation or an exception with the details of what went wrong.
- Delayed send: you can specify a time in the future when the email should be sent
Additional NOTE: The system is based on the excellent Simple Java Mail library If necessary you can completely bypass our PostOffice service and build your own mailing system with this API.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcom.smartfoxserver.config.MailerSettingsObtain the configuration settings of the servicegetName()voidhandleMessage(Object message) voidvoidSends the email to the recipient, or list of recipients, specified in the Email argument.voidsendMail(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.voidsendMail(Email email, IMailerCallbackHandler callBack, int delaySeconds) Sends an email in the future.void
-
Constructor Details
-
SFSPostOffice
public SFSPostOffice()
-
-
Method Details
-
init
- Specified by:
initin interfacecom.smartfoxserver.bitswarm.service.IService- Internal
-
destroy
- Specified by:
destroyin interfacecom.smartfoxserver.bitswarm.service.IService- Internal
-
getName
- Specified by:
getNamein interfacecom.smartfoxserver.bitswarm.service.IService- Internal
-
getConfiguration
public com.smartfoxserver.config.MailerSettings getConfiguration()Obtain the configuration settings of the service- Specified by:
getConfigurationin interfaceIMailerService- Returns:
- the configuration settings of the service
-
sendMail
public void sendMail(Email email, IMailerCallbackHandler callBack) throws org.simplejavamail.MailException 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.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 Simple Mail core module(found under lib/sjm/coremodule-x.y.z.jar) to your project's libraries.
- Specified by:
sendMailin interfaceIMailerService- Parameters:
email- the email to sendcallBack- the callback handler, if null no event will be fired- Throws:
org.simplejavamail.MailException- an error might be caused by malformed email addresses either in the TO or FROM fields- See Also:
-
sendMail
Sends the email to the recipient, or list of recipients, specified in the Email argument.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 Simple Mail core module(found under lib/sjm/coremodule-x.y.z.jar) to your project's libraries.
- Specified by:
sendMailin interfaceIMailerService- Parameters:
email- the email to send- Throws:
org.simplejavamail.MailException- an error might be caused by malformed email addresses either in the TO or FROM fields- See Also:
-
sendMail
public void sendMail(Email email, IMailerCallbackHandler callBack, int delaySeconds) throws org.simplejavamail.MailException Sends an email in the future. The email can be sent to one recipient or a list of recipients specified in the Email argument. If a callback handler is provided the system will fire an asynchronous event when the email is delivered.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 Simple Mail core module(found under lib/sjm/coremodule-x.y.z.jar) to your project's libraries.
- Specified by:
sendMailin interfaceIMailerService- Parameters:
email- the email to sendcallBack- the callback handler, if null no event will be fireddelaySeconds- the amount of seconds to wait before sendint the mail- Throws:
org.simplejavamail.MailException- an error might be caused by malformed email addresses either in the TO or FROM fields- See Also:
-
handleMessage
- Specified by:
handleMessagein interfacecom.smartfoxserver.bitswarm.service.IService- Internal
-
setName
- Specified by:
setNamein interfacecom.smartfoxserver.bitswarm.service.IService- Internal
-