Skip to content

Instantly share code, notes, and snippets.

@virtix
Created May 19, 2010 19:22
Show Gist options
  • Save virtix/406726 to your computer and use it in GitHub Desktop.
Save virtix/406726 to your computer and use it in GitHub Desktop.
import org.apache.commons.mail.*
mail_server = 'mail.server'
def send_mail = { cnt,sender,recipient,headers ->
println 'sending mail ' + cnt
email = new SimpleEmail();
email.setHostName mail_server
email.addTo recipient, 'to_' + cnt
email.setFrom sender, 'from_' + cnt
email.setSubject 'Test message ' + cnt
email.setHeaders(headers);
email.setMsg 'testing ... ' + cnt
email.send()
println 'happy mail sent'
}
for (i in 1..10) {
headers = ['x-some-header':'value']
send_mail i,'[email protected]','[email protected]', headers
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment