img2attach
Replace images urls from html email content to content-id resources links
Send beautiful HTML emails without external images ;)
Install
npm install img2attach [--save]
Usage
Simple
var img2attach = ; var html = '<img src="http://cs624028.vk.me/v624028538/276f5/2ASEewrS9xk.jpg">'; ;
With nodemailer
var img2attach = ;var nodemailer = ; var html = '<img src="http://cs624028.vk.me/v624028538/276f5/2ASEewrS9xk.jpg">'; var transporter = nodemailer; ;
API
img2attach(html)
html - html string like
return promise (used Q)
img2attach(html).then(function(data) {})
data - javascript object
html: '<img src="cid:1">' //cid - url to content-id attachment attachments: cid: 1 src: '1.png' encoding: 'base64' content: 'encoded_data' //base64 encoded data contentType: 'image/jpg' ;