Description
The Send Email plugin will take a list of org.blojsom.plugin.email.EmailMessage objects and send them via SMTP.
Installation and Setup
In your global /WEB-INF/plugin.properties file, add the following line:
sendemail=org.blojsom.plugin.email.SendEmailPlugin
You may then add "sendemail" to the end one of the flavor-based plugin chains. These plugin chains can be found in the individual user's plugin.properties file. For example:
html.blojsom-plugin-chain=..., sendemail
Typically, this would be done after the comment and trackback plugins are run as they publish comments and trackbacks in the context that are picked up later on in the plugin chain by this plugin.
In your individual blog.properties file, add the following line:
blog-email-enabled=true
The Send Email plugin requires the SMTP server be defined in /WEB-INF/web.xml. The parameter is smtp-server. Include the following elements along with the other initialization parameters for the blojsom servlet element. For example:
<init-param>
<param-name>smtp-server</param-name>
<param-value>localhost</param-value>
</init-param>
Using a JNDI context for mail settings
Available in blojsom 2.21 and above.
If the value for the smtp-server parameter starts with java:comp/env, then blojsom will try to lookup the JNDI context for the mail settings. Look at your application server documentation for information on setting a JNDI. As an example, the Tomcat JDNI resources HOW-TO
has a section on JavaMail sessions. From their example, if using a JDNI mail session, your smtp-server parameter value would be java:comp/env/mail/Session.
Using SMTP server authentication credentials
Available in blojsom 2.21 and above.
You can also define authentication credentials for your SMTP server. These parameters are also defined in /WEB-INF/web.xml. The parameter names are smtp-server-username and smtp-server-password. Include the following elements along with the other initialization parameters for the blojsom servlet element.
For example:
<init-param>
<param-name>smtp-server-username</param-name>
<param-value>username</param-value>
</init-param>
<init-param>
<param-name>smtp-server-password</param-name>
<param-value>password</param-value>
</init-param>
Usage and URL Parameters
Context Attributes and Types
The following table describes the context attributes that are available and their associated type.
| Context key |
Input or Output |
Type |
Description |
| BLOJSOM_OUTBOUNDMAIL |
Input |
java.util.List of org.blojsom.plugin.email.EmailMessage objects |
Contains the list of e-mail messages that should be sent by the plugin |