I've got the below code. My problem is I want to send zero (or more) files, and I'm not sure how to do it. Ant requires you to set a base directory for your fileset, but for this method I don't know what that would be. How can I add an arbitrary list of zero or more files to be attached?
public void send(File[] files){
ant.mail (
from: "IMSBatch@vanguard.com",
tolist: to,
message: msg,
subject : subject,
mailhost: host,
messagemimetype: 'text/html'
){
attachments(){
fileset(dir: ????){
include(arbitrary list of files)
}
}
}
}
Side note, I ran into a bug where this code actually broke when I had a setAttachments()
method elsewhere in my class. I think either Ant or Groovy got names mixed up between that and the attachments
method of AntBuilder.