grails / grails-mail

The Grails Mail Plugin
https://grails.github.io/grails-mail/
Apache License 2.0
15 stars 25 forks source link

Option to set subject and text by message code #27

Closed davidkron closed 5 years ago

davidkron commented 7 years ago

I tried implementing my feature suggestion from issue https://github.com/grails3-plugins/mail/issues/22 to allow for an easy way to set mail subject and text by a message code, also considering the the already existing locale option from the mail dsl.

Example usage:

mailService.sendMail {
    locale user.languageForCorrespondence
    subject message('mail.summary.subject')
    text message('mail.summary.text')
}
sbglasius commented 5 years ago

I don't think this should be a responsibility for the mail plugin, but rather something the user of the plugin needs to do before calling the sendMail code, but that's my opinion.