mixmaxhq / nodemailer-plugin-inline-base64

Nodemailer plugin to inline base64 images
MIT License
43 stars 11 forks source link

Uncaught error when content is loaded from file #1

Open gergoerdosi opened 9 years ago

gergoerdosi commented 9 years ago

Nodemailer supports loading content from a file:

var mail = {
   data: {
       html: {
           path: __dirname + '/fixtures/message.html'
       }
   }
};

An error is raised when this plugin is used:

    TypeError: Uncaught error: Object <p>example</p>
 has no method 'replace'
    at replaceBase64Images (/.../node_modules/nodemailer-plugin-inline-base64/src/replaceBase64Images.js:2:16)

This is happening because Nodemailer returns a buffer when a file is loaded, not a string.

bradvogel commented 9 years ago

You right, it doesn't support a stream currently. Will look at this a bit later. But in the meantime, PRs welcome!