Category Archives: Asynchronous mail

How to attach multiple attachments with mail in grails?

For sending mail you can use Asynchronous Mail Plugin.

1. Install Asynchronous Mail Plugin :

Dependency:  compile “:asynchronous-mail:1.2″

2. Usage :

Add following:

import grails.plugin.asyncmail.AsynchronousMailService

     AsynchronousMailService asynchronousMailService

3. In your method to add multiple attachment create map as shown below,

Map<String,ByteArrayOutputStream> attachments = new HashMap<String,ByteArrayOutputStream>();

ByteArrayOutputStream bytes0,bytes1,bytes2; // attachments




asynchronousMailService.sendMail {
multipart true
to emailID
subject emailSubject
html emailBodyContent
attachBytes “Approval”, “application/pdf”, attachments


attachBytes is used to attach attachments.

ProsperaSoft offers Grails development solutions. You can email at to get in touch with ProsperaSoft Grails experts and consultants.