The Grails mail plugin provides a convenient DSL for sending email. It supports plain text, html, attachments, inline resources and i18n among other features.
Mail can be sent using the @mailService@ via the @sendMail@ method. Here is an example…
mailService.sendMail {
to "fred@gmail.com","ginger@gmail.com"
from "john@gmail.com"
cc "marge@gmail.com", "ed@gmail.com"
bcc "joe@gmail.com"
subject "Hello John"
text 'this is some text'
}
Please see the User Guide for more information.
The plugin is released under the Apache License 2.0 and is produced under the Grails Plugin Collective.
Per mail signing and encryption. The domain option changes the Message-ID to look like 1457016543218.1481006193.myserver@example.com
mailService.sendMail {
sign [ keyStoreLocation:'/opt/keys/key.p12',
keyStorePassword : 'dummy',
keyPassword : 'dummy',
keyAlias : 'Dummy User']
encrypt [ trustStoreLocation:'/opt/certs/cert.p12',
trustStorePassword : 'dummy',
certAlias : 'Dummy User']
domain 'example.com'
to "fred@gmail.com","ginger@gmail.com"
from "john@gmail.com"
cc "marge@gmail.com", "ed@gmail.com"
bcc "joe@gmail.com"
subject "Hello John"
text 'this is some text'
}
Global settings for every mail unless overriden:
grails {
mail {
host = "smtp.uni-erlangen.de"
port = 25
domain = 'example.com'
sign = [ keyStoreLocation:'/opt/keys/key.p12',
keyStorePassword : 'dummy',
keyPassword : 'dummy',
keyAlias : 'Dummy User']
encrypt = [ trustStoreLocation:'/opt/certs/cert.p12',
trustStorePassword : 'dummy',
certAlias : 'Dummy User']
}
}
Issues can be raised via the Codehaus Jira.
Pull requests are the preferred method for submitting contributions. Please open an issue via that issue tracker link above and create an issue describing what your contribution addresses.
If you are contributing documentation, raising an issue is not necessary.