Attachments
Attach files to a message, from disk or from memory. Files are encrypted and sent with the message; the recipient downloads them from the message page.
Prerequisites
A send that already works without attachments: see Send a message.
From disk
Pass the list of file paths.
var args = new MutliRecipientArgs(
endPointUri: endpoint, serial: serial, user: apiUser, psw: apiPassword,
recipients: recipients, message: message, subject: subject,
password: null, filesList: null,
sendMode: SendMethodEnum.onlyEmail, getBackHtml: false,
showSubject: true, getNotify: true, cultureID: "en-CA",
maximumOpenTime: 5, minutesExpiration: 10080);
args.FilesPath = new List<string> { contractPath, appendixPath };
var response = MessageHelper.MultiRecipientMessage(args);
From memory
For a file produced by your application (a generated report, for example), pass its content and name without going through the disk.
var files = new List<FileArgs>
{
new FileArgs(reportPdf, "report.pdf", "application/pdf")
};
var args = new MutliRecipientArgs(
endPointUri: endpoint, serial: serial, user: apiUser, psw: apiPassword,
recipients: recipients, message: message, subject: subject,
password: null, filesList: files,
sendMode: SendMethodEnum.onlyEmail, getBackHtml: false,
showSubject: true, getNotify: true, cultureID: "en-CA",
maximumOpenTime: 5, minutesExpiration: 10080);
Good to know
| Point | Detail |
|---|---|
| Size | Up to 25 GB per send. |
| Number of files | No specific limit, within the size limit. |
| Disk or memory | Both can be used in the same send. For a large file, see Large files. |
| MIME type | In .NET and Python, FileArgs requires the file type: see the table below. |
| Extension | MIME type |
|---|---|
.pdf |
application/pdf |
.docx |
application/vnd.openxmlformats-officedocument.wordprocessingml.document |
.xlsx |
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
.png |
image/png |
.jpg |
image/jpeg |
.zip |
application/zip |
.txt |
text/plain |
Warning
Security.
- Paths: never use a path supplied by a user as is. Restrict sending to a known folder and check the final path; otherwise any file on the server could be sent.
- Message content: if the HTML message contains data entered by someone (a name, a file name), HTML-encode it before inserting it.
Common errors
| Symptom | Likely cause | Solution |
|---|---|---|
| File not found | Path relative to the wrong folder, or missing read permission | Use an absolute path and check that the service account can read the file. |
| Status 400 | Total size exceeded | Reduce the size or split the files across several sends. |
| The recipient does not see the file | Send failed for that recipient | Check their status in the answer: see Multiple recipients. |
Next
- Large files
- Digital signature: get a PDF signed
- Download received files