Build a raw email with streams


This is a very early release of something that I would welcome any help with. I appreciate that I am unlikely to have covered all of the RFCs that cover the email specifications. Please submit pull requests, issues and anything else.

EmailStream is a module to allow you to build a raw email stream from multiple streams.

npm install email-stream
var emailStream = require('email-stream');
var email = emailStream({
  to: '',
  from: '',
  subject: 'Test Subject',
  text: textStream,
  html: htmlStream

// Pipe the textStream
// Pipe the htmlStream

A text stream is required for all emails and a HTML stream is optional

If you want to add attachments to the email, add attachments: true to the initialisation function. Eg.

var email = emailStream({
  to: '',
  attachments: true

  filename: 'attachment.svg',
  type: 'text/svg',
  body: attachmentStream

  filename: 'attachment2.mp4',
  type: 'video/mp4',
  body: attachmentStream2