This is a very quick article on sending an email with Deluge which needs a dynamic number of files attached to it.
Why?
This came up during a call with another developer and it occurred to me that perhaps this isn't clearly documented. But there are tips found across the web just not specifically addressing this.
How?
Here is the code for a test function which downloads 2 files from a public domain, no user wall. The key here which the official documentation is missing is the .setParamName() but for those who have spent time to find this function, they'll already know this.
void fn_Joel_Test()
{
/***
- tried with getUrl() but this doesn't work.
- has to be an invokeUrl
- set param name required
- if file comes from a Creator form, no InvokeURL needed
c_Form = Form[ID == 1234];
r_Download1 = c_Form.myFieldWithFile;
***/
l_Downloads = List();
r_Download1 = invokeUrl
[
url: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
type: GET
];
r_Download1.setParamName("file");
l_Downloads.add(r_Download1);
r_Download2 = invokeUrl
[
url: "https://www.africau.edu/images/default/sample.pdf"
type: GET
];
r_Download2.setParamName("file");
l_Downloads.add(r_Download2);
//
sendmail
[
from: zoho.adminuserid
to: "info@joellipman.com"
subject: "Test File: List"
message: "This is just a test"
attachments: file: l_Downloads
]
}
Yields

Discussion
Comments
Questions, corrections and useful additions are reviewed before appearing here.
No comments yet. Start the discussion.