File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ var nodemailer = require ( 'nodemailer' ) ;
2+ var sgTransport = require ( '../src/sendgrid-transport.js' ) ;
3+
4+ var options = {
5+ auth : {
6+ api_user : process . env [ 'SENDGRID_USERNAME' ] ,
7+ api_key : process . env [ 'SENDGRID_PASSWORD' ]
8+ }
9+ }
10+
11+ var mailer = nodemailer . createTransport ( sgTransport ( options ) ) ;
12+
13+ var email = {
14+ to : [ 'foo@example.com' , 'bar@example.com' ] ,
15+ from : 'baz@example.com' ,
16+ subject : 'Hi there' ,
17+ text : 'Awesome sauce' ,
18+ html : '<b>Awesome sauce</b>' ,
19+ attachments : [
20+ {
21+ filename : 'test.txt' ,
22+ path : __dirname + '/test.txt'
23+ }
24+ ]
25+ } ;
26+
27+ mailer . sendMail ( email , function ( err , res ) {
28+ if ( err ) {
29+ console . log ( err )
30+ }
31+ console . log ( res ) ;
32+ } ) ;
Original file line number Diff line number Diff line change 1+ Hello text
You can’t perform that action at this time.
0 commit comments