There is already a well-written article about how to send email using Grails hosted on grails.org. As it is already stated there, you need to add the JavaMail and JAF JAR files to your Grails app’s lib directory to be able to send email from your Grails app. However, instead of manually downloading these files and placing them under the lib directory, you can simply uncomment the following two lines of the BuildConfig.groovy file:
and add the appropriate dependencies under the dependencies part of the BuildConfig.groovy:
Then the first time you run your application, Grails will automatically download the specified version of these JAR files for you and places them on the classpath of your application thereafter.
The tricky part is how to use Gmail as the SMTP provider. To do so, you need to configure the mailSender Spring bean as follows:
You can learn more about these JavaMail configuration properties here. In case your SMTP provider does not require encryption, the configuration will be much simpler:
You can download the completed application which lets you compose and send plain text emails from here.