The Official MailPace Blog

Send attachments with transactional emails

February 18, 2021

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 Key
const MailPace = require('@mailpace/mailpace.js');
const client = new MailPace.DomainClient(api_key);

// Prepare the attachment for sending
const fs = require('fs')
const file_buffer  = fs.readFileSync("image.jpg");
const contents_in_base64 = file_buffer.toString('base64');

// Craft the email
const email = {
  from: ``,
  to: '',
  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!


  • 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:

Questions, comments?

Contact us at

You've read this far, want more?

By Paul, founder of MailPace. Follow our journey onΒ Mastodon andΒ Twitter, and sign up to our Product Newsletter.