Β· Changelog Β· 1 min read
Send attachments with transactional emails
πππ We now support sending attachments over email! π₯³π₯³π₯³π₯³
You can now send attachments with MailPace!
Based on lots of customer feedback, weβve added the ability send attachments over MailPace. Weβve built support into our Rails and Node libraries, as well as the HTTPS API and SMTP servers.
How to send an email with an attachment
Hereβs a simple example in JavaScript, using our NPM library.
// Include the OMS library and add the API Keyconst MailPace = require('@mailpace/mailpace.js');const client = new MailPace.DomainClient(api_key);
// Prepare the attachment for sendingconst fs = require('fs');const file_buffer = fs.readFileSync('image.jpg');const contents_in_base64 = file_buffer.toString('base64');
// Craft the emailconst email = { from: `test@yourdomain.com`, to: 'person@address.com', subject: 'Attachment Email', htmlbody: '<p>There is an attachment attached!</p>', attachments: [ { name: 'image.png', content_type: 'image/png', content: contents_in_base64, }, ],};
// Send the email!client.sendEmail(email);
Limitations
- Total email size must not exceed 30MB (including all email content)
- To help prevent the spread of viruses and other malware, we limit the types of file that can be sent through our system - you can read more about those here: https://docs.mailpace.com/reference/send#attachments
Questions, comments?
Contact us at support@mailpace.com
Share: