We have been coming across a certain use case in a couple of projects that the Email credentials/settings used for sending email should be different based on the from address. This is because the applications act as software services that are used by different organizations, which operate in the same business. And each needed their own customized emails and use their email credentials for sending of mails.
After searching a lot for such a solution, we found that such a use case has arisen for quite a few developers.
Another demand was that a mail service provider like GMail be used to send emails instead of using a mail server like Postfix of Sendmail.
What we came up was a modified version of the grails mail plugin, which works with DB driven mail configurations. It defaults to Config.groovy it it fails to fetch the MailConfig domain object based on the from address, which we usually in the sendMail() method. The plugin makes use of a customMailSender bean, which is actually a copy of the mailSender bean which gets built from Config.groovy, but can be modified in a thread safe environment with values fetched from the DB.
Hope you find this useful