Mailosaur logo
Mailosaur logo

Sending email out from Mailosaur

Use the sending function in Mailosaur to simulate someone sending an email to your product.

Available with any of the following plans, except where noted:

Business, Professional and Enterprise

If your product is capable of handling inbound emails, you can use Mailosaur’s sending feature to trigger this functionality in your product.

Sending an email to start a test
A hashtag icon

You can send emails within the Mailosaur Dashboard, or via the API:

  1. Go to the Servers page in the Mailosaur Dashboard.
  2. Click on a server.
  3. Click on New Message at the top of the page.
  4. Select the email address to send to. You can only send to verified external email addresses.
  5. Enter the subject and message body for the email (Note: the message body field supports Markdown syntax.)
  6. When you are finished, click Send.

A hashtag icon

You can include attachments in emails sent via the API, by including an array of base64-encoded attachment objects:

const attachments = [{
  fileName: 'cat.png',
  contentType: 'image/png',
  content: '{BASE64_ENCODED_FILE}'

await mailosaur.messages.create('{SERVER_ID}', {
  to: '', // must be a verified address
  subject: 'Email from Mailosaur',
  html: '<p>Hello world.</p>',
  send: true,
  attachments: attachments

The content property of an attachment should be the base64-encoded content of the file you want to attach. Here’s an example of how to base64-encode a file:

const fs = require('fs');

// ...

const buffer = fs.readFileSync('/path/to/file.txt');
const content = buffer.toString('base64');