Skip to end of metadata
Go to start of metadata

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

(error)

either 'smtp' for regular SMTP or 'smtps' for SMTP with SSL. Defaults to 'smtp'

mailhost

String

(tick)

the address of the SMTP server, e.g. 'smtp.google.com'

port

String

(error)

the port of the SMTP server. Defaults appropriately for the transport specified

auth

boolean

(error)

true if authentication is required, false otherwise. Defaults to false

user

String

(error)

the username for authenticating with the SMTP server. Only used if auth=true

password

String

(error)

the password for authenticating with the SMTP server. Only used if auth=true

from

String

(error)

the message sender, e.g. 'foo@bar.com'

to

String

(tick)

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

(error)

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

(error)

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

(error)

the message subject

text

String

(error)

the message content

html

String

(error)

the message content in HTML

attachments

List<String>

(error)

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

  1. As of version 0.2 this plugin supports plain text, HTML, attachments, or some combination thereof.
  2. sendMail blocks 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

  • No labels