Grails – sending email using ant for google hosted apps
The following entry pretty much covers the basic case for sending email using gmail smtp server. If you needed to send with an attachment you can use the attachments closure as mentioned below.
new AntBuilder().mail(
mailHost : CH.config.mail.host,
mailPort : CH.config.mail.port,
ssl : CH.config.mail.ssl,
user : CH.config.mail.user,
password : CH.config.mail.password,
subject : "Daily report"
) {
from(address:"${fromName} ")
to(address:to)
message(mimetype : "text/html", "Daily report")
attachments() {
fileset(dir:'.'){
include(name:'hello.csv')
}
}
}