email-stream
v0.1.0
Published
Build a raw email with streams
Downloads
1
Readme
EmailStream
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.
Installation
npm install email-stream
Usage
var emailStream = require('email-stream');
var email = emailStream({
to: '[email protected]',
from: '[email protected]',
subject: 'Test Subject',
text: textStream,
html: htmlStream
});
// Pipe the textStream
// Pipe the htmlStream
email.pipe(process.stdout);
Notes
A text stream is required for all emails and a HTML stream is optional
Attachments
If you want to add attachments to the email, add attachments: true
to the initialisation function. Eg.
var email = emailStream({
to: '[email protected]',
...
attachments: true
});
email.attach({
filename: 'attachment.svg',
type: 'text/svg',
body: attachmentStream
});
email.attach({
filename: 'attachment2.mp4',
type: 'video/mp4',
body: attachmentStream2
});