Documentation
Sending Attachments
Yes you can also send attachments (documents, images and more) alongside your emails using our send API. We accept all file formats and there are no known file size limits. Attachments can be added as URLs or direct file uploads. We highly recommend sending urls as this would be processed faster that direct file uploads.
Sending an attachment with your mail
1// npm install smtpexpress
2import { createClient } from "smtpexpress"
3const smtpexpressClient = createClient({...});
4
5smtpexpressClient.sendApi.sendMail({
6 ...
7 attachments: [
8 "https://link-to-image.png",
9 "https://link-to-document.png"
10 ]
11});
Direct file uploads as attachment
The send API supports multipart/formdata to facilitate direct file uploads. While it's great, it also means the method of sending your request could change very quickly. To relieve developers of this, we have fully accounted for the intricacies involved with direct file uploads in all available SDKs and we strongly recommend you opt for that as opposed to setting up from scratch.
Attachments Parameters
attachments
StringArray | FileArrayAttachments can be a array of URLs or File objects for direct file upload