Description
The Mail plugin adds the ability to send email from your Griffon application.
Installation
The current version of griffon-mail-plugin is 0.3
To install just issue the following command
Usage
This plugin injects a sendMail(Map args) method into all controllers where args may contain:
Property |
Type |
Required |
Notes |
|---|---|---|---|
transport |
String |
either 'smtp' for regular SMTP or 'smtps' for SMTP with SSL. Defaults to 'smtp' |
|
mailhost |
String |
the address of the SMTP server, e.g. 'smtp.google.com' |
|
port |
String |
the port of the SMTP server. Defaults appropriately for the transport specified |
|
auth |
boolean |
true if authentication is required, false otherwise. Defaults to false |
|
user |
String |
the username for authenticating with the SMTP server. Only used if auth=true |
|
password |
String |
the password for authenticating with the SMTP server. Only used if auth=true |
|
from |
String |
the message sender, e.g. 'foo@bar.com' |
|
to |
String |
the message recipient(s), e.g. 'foo@bar.com'. Multiple addresses may be specified as a comma-separated list, e.g. 'foo@bar.com, bar@bar.com' |
|
cc |
String |
the CC recipients(s), e.g. 'foo@bar.com'. Multiple addresses may be specified as a comma-separated list, e.g. 'foo@bar.com, bar@bar.com' |
|
bcc |
String |
the BCC recipients(s), e.g. 'foo@bar.com'. Multiple addresses may be specified as a comma-separated list, e.g. 'foo@bar.com, bar@bar.com' |
|
subject |
String |
the message subject |
|
text |
String |
the message content |
|
html |
String |
the message content in HTML |
|
attachments |
List<String> |
the list of file paths (as Strings) to attach to the email. |
Examples
Sending a regular email:
Sending an email via Google's SMTP server:
Sending an HTML email with an attachment via Google's SMTP server:
Configuration
sendMail will be added to controllers by default. You can change this setting by adding a configuration flag in Application.groovy
Notes
- As of version 0.2 this plugin supports plain text, HTML, attachments, or some combination thereof.
sendMailblocks until the mail is sent or until the request times out. You are responsible for making sure it is called off of the EDT so it doesn't affect your application if the SMTP server is not available.
History
Version |
Date |
Notes |
|---|---|---|
0.3 |
12-21-10 |
Release sync with Griffon 0.9.2 |
0.2 |
11-14-09 |
Added HTML and attachment support |
0.1 |
11-05-09 |
Initial release |


