Skip to content

Instantly share code, notes, and snippets.

@stewartjarod
Created April 11, 2013 18:00
Show Gist options
  • Save stewartjarod/5365678 to your computer and use it in GitHub Desktop.
Save stewartjarod/5365678 to your computer and use it in GitHub Desktop.
Send email with attachment Second Method... Should work with Azure.
var sg = require('sendgrid');
var email = new sg.Email({
to: '[email protected]',
toname: 'Test Person',
from: '[email protected]',
fromname: 'Test Sender',
subject: 'Email Test with Image',
text: 'This is a test.',
html: 'this is a test <img src="cid:testme" alt="graphic"/>',
});
email.addFile({
filename: 'SendGrid.png',
url: 'http://i.techgox.com/img/companies/startups/SendGrid.png'
});
var sendgrid = new sg.SendGrid('username','password');
sendgrid.send(email, function(success, error) {
if(!success) console.error(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment