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 account@googlemail.com
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(
  "sender@your.domain", 
  "recipient@other.domain",
  "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().

Last modified on 2011-04-24 by Maik Jablonski

Want to contribute?

1970-01-01

Do you want to contribute to Jease? Writing documentation is a good place to get started and will help to get people becoming more familiar with Jease. Any contribution is appreciated.