Mails
Jease allows you to send emails via a general mail service. In order to enable the mail service (e.g. to get notifications about added comments), you have to configure access to a SMTP-server.
Therefore you have to create a new parameter called JEASE_SMTP_PROPERTIES via CMS » System » Parameter and fill in the corresponding Java-Mail-Properties.
Here's an example which shows how to use the GoogleMail as SMTP-Server for your site:
mail.smtp.host smtp.googlemail.com mail.smtp.auth true mail.smtp.port 465 mail.smtp.socketFactory.port 465 mail.smtp.socketFactory.class javax.net.ssl.SSLSocketFactory mail.smtp.socketFactory.fallback false mail.smtp.user [email protected] mail.smtp.password topsecret
Sending Mails
In order to send an email, you can simply call the mail service from Java/JSP/Script after it has been configured:
<% jease.cms.service.Mails.dispatch( "[email protected]", "[email protected]", "The Subject", "The body of your Email" ); %>
Please note: Mails.dispatch(...) sends the email in a separate thread, so the program execution isn't blocked while the SMTP-server is connected. If you want to send an email synchronously (e.g. useful for testing), you can use Mails.send().