-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds ability to send email via gmail. #85
- Loading branch information
Showing
8 changed files
with
93 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
var nodemailer = require('nodemailer'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var htmlpath = path.resolve(__dirname +'/../templates/welcome_html.html'); | ||
var textpath = path.resolve(__dirname +'/../templates/welcome_text.txt'); | ||
var template = fs.readFileSync(htmlpath, 'utf8') | ||
var textonly = fs.readFileSync(textpath, 'utf8') | ||
// create reusable transporter object using SMTP transport | ||
var transporter = nodemailer.createTransport({ | ||
service: 'Gmail', | ||
auth: { | ||
user: '[email protected]', | ||
pass: process.env.GMAIL_PASSWORD | ||
} | ||
}); | ||
|
||
// NB! No need to recreate the transporter object. You can use | ||
// the same transporter object for all e-mails | ||
|
||
var email = function(person, callback){ | ||
var mailOptions = { | ||
from: '#dwyl do what you love! <[email protected]>', // sender address | ||
to: person.email, // list of receivers | ||
subject: 'Welcome to dwyl!', // Subject line | ||
text: textonly, // plaintext body | ||
html: template | ||
}; | ||
// send mail with defined transport object | ||
transporter.sendMail(mailOptions, function(error, info){ | ||
// console.log(error, info); | ||
callback(error, info) | ||
}); | ||
} | ||
|
||
var person = { | ||
email : '[email protected]', | ||
name : 'FirstName' | ||
} | ||
|
||
// email(person, function(error,info){ | ||
// console.log('hello!'); | ||
// console.log(info); | ||
// }) | ||
|
||
module.exports = email; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<p>Hi!</p> | ||
|
||
<p>Thanks so much for joining us to alpha test dwyl, we’re excited to have you!</p> | ||
|
||
<p>For now, dwyl will help you track your time and soon it will help you do much more, including | ||
<a href="https://github.com/ideaq/start-here/blob/master/manifesto.md"> | ||
making time for what you love | ||
<a/>. | ||
</p> | ||
|
||
<p>If you have any questions or find any bugs, big or small, please drop us a note or <a href="https://github.com/ideaq/time/labels/MVP">add an issue to github</a>, we <i>really appreciate</i> it!</p> | ||
|
||
<p>Happy dwyling!</p> | ||
Ines & Nelson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Hi! | ||
|
||
Thanks so much for joining us to alpha test dwyl, we’re excited to have you! | ||
|
||
For now, dwyl will help you track your time and soon it will help you do much more, including making time for what you love. https://github.com/ideaq/start-here/blob/master/manifesto.md | ||
|
||
If you have any questions or find any bugs, big or small, please drop us a note or add an issue to github: | ||
https://github.com/ideaq/time/labels/MVP We really appreciate it! | ||
|
||
Happy dwyling | ||
Ines & Nelson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters