Grails – sending email using ant for google hosted apps

February 9, 2009 at 8:29 pm (technology) (, )

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')
}
}
}

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.