From ab9dc263404de6f8dafb82dc4b86410c0bf5c02c Mon Sep 17 00:00:00 2001 From: Jake Larson Date: Wed, 23 Apr 2014 11:53:18 -0500 Subject: [PATCH 1/4] Update README.md Added documentation for using Mandrill email service --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bd43c0e260..857b463fca 100644 --- a/README.md +++ b/README.md @@ -303,6 +303,15 @@ The same goes for other providers. - Sign up and add your *Domain Name* - From the domain overview, copy and paste the default SMTP *Login* and *Password* into `config/secrets.js` +
+ + +- Go to http://mandrill.com +- Sign up and add your *Domain Name* +- From the dashboard, click on *Get SMTP credentials +- Copy and paste the default SMTP *Login* and *Password* into `config/secrets.js` + + Project Structure ----------------- @@ -363,7 +372,6 @@ List of Packages | github-api | GitHub API library. | | jade | Template engine for Express. | | lastfm | Last.fm API library. | -| instagram-node | Instagram API library. | | less | LESS compiler. Used implicitly by connect-assets. | | lusca | CSRF middleware. | | mongoose | MongoDB ODM. | @@ -375,7 +383,6 @@ List of Packages | passport-github | Sign-in with GitHub plugin. | | passport-google-oauth | Sign-in with Google plugin. | | passport-twitter | Sign-in with Twitter plugin. | -| passport-instagram | Sign-in with Instagram plugin. | | passport-local | Sign-in with Username and Password plugin. | | passport-linkedin-oauth2 | Sign-in with LinkedIn plugin. | | passport-oauth | Allows you to set up your own OAuth 1.0a and OAuth 2.0 strategies. | @@ -602,7 +609,7 @@ reference guide. I have explained my reasons why it could not be merged in ### How do I switch SendGrid for another email delivery service? Run `node generator.js` bundled with Hackathon Starter, then select **Email Service** option. It will automatically replace appropriate strings in -your code. Currently there are only two options: SendGrid and Mailgun. +your code. Currently there are three options: SendGrid, Mandrill, and Mailgun. How It Works (mini guides) -------------------------- From b8dbe3cebe66372096f173c05547cd90190705f4 Mon Sep 17 00:00:00 2001 From: Jake Larson Date: Wed, 23 Apr 2014 11:56:57 -0500 Subject: [PATCH 2/4] Update generator.js Added Mandrill option to generator --- generator.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/generator.js b/generator.js index d5db7e50de..d0f0ba4cfd 100644 --- a/generator.js +++ b/generator.js @@ -30,7 +30,7 @@ inquirer.prompt({ type: 'list', name: 'email', message: 'Choose Email Delivery Service:', - choices: ['SendGrid', 'Mailgun', 'Cancel'] + choices: ['SendGrid', 'Mailgun', 'Mandrill', 'Cancel'] }, function(answer) { var index; @@ -86,6 +86,29 @@ inquirer.prompt({ console.log('✓ Email Delivery Service has been switched to'.info, '@'.error + 'mail'.data + 'gun'.error); } + + if (answer.email.match('Mandrill')) { + + // Change SMPT Transport to Mailgun in controllers/contact.js + index = contactController.indexOf('var smtpTransport = nodemailer.createTransport(\'SMTP\', {'); + contactController.splice(index + 1, 1, ' service: \'Mandrill\','); + contactController.splice(index + 3, 1, ' user: secrets.mandrill.login,'); + contactController.splice(index + 4, 1, ' pass: secrets.mandrill.password'); + fs.writeFileSync(contactControllerFile, contactController.join(os.EOL)); + + // Change SMPT Transport to Mailgun in controllers/user.js + index = userController.indexOf(' var smtpTransport = nodemailer.createTransport(\'SMTP\', {'); + userController.splice(index + 1, 1, ' service: \'Mandrill\','); + userController.splice(index + 3, 1, ' user: secrets.mandrill.login,'); + userController.splice(index + 4, 1, ' pass: secrets.mandrill.password'); + index = userController.indexOf(' var smtpTransport = nodemailer.createTransport(\'SMTP\', {', 1); + userController.splice(index + 1, 1, ' service: \'Mandrill\','); + userController.splice(index + 3, 1, ' user: secrets.mandrill.login,'); + userController.splice(index + 4, 1, ' pass: secrets.mandrill.password'); + fs.writeFileSync(userControllerFile, userController.join(os.EOL)); + + console.log('✓ Email Delivery Service has been switched to'.info, 'Mandrill'.help); + } }); } @@ -1039,4 +1062,4 @@ inquirer.prompt({ } }); } -}); \ No newline at end of file +}); From 3656e574a12e61c47e02916e1c20538490dece01 Mon Sep 17 00:00:00 2001 From: Jake Larson Date: Wed, 23 Apr 2014 13:04:31 -0500 Subject: [PATCH 3/4] Update generator.js Fixed issue where email provider was not being set correctly within the user controller. The second instance of the `'var smtpTransport = nodemailer.createTransport(\'SMTP\', {'` was not being caught. --- generator.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generator.js b/generator.js index d0f0ba4cfd..53cd38ce6c 100644 --- a/generator.js +++ b/generator.js @@ -55,7 +55,7 @@ inquirer.prompt({ userController.splice(index + 1, 1, ' service: \'SendGrid\','); userController.splice(index + 3, 1, ' user: secrets.sendgrid.user,'); userController.splice(index + 4, 1, ' pass: secrets.sendgrid.password'); - index = userController.indexOf(' var smtpTransport = nodemailer.createTransport(\'SMTP\', {', 1); + index = userController.indexOf(' var smtpTransport = nodemailer.createTransport(\'SMTP\', {', (index + 1)); userController.splice(index + 1, 1, ' service: \'SendGrid\','); userController.splice(index + 3, 1, ' user: secrets.sendgrid.user,'); userController.splice(index + 4, 1, ' pass: secrets.sendgrid.password'); @@ -78,7 +78,7 @@ inquirer.prompt({ userController.splice(index + 1, 1, ' service: \'Mailgun\','); userController.splice(index + 3, 1, ' user: secrets.mailgun.login,'); userController.splice(index + 4, 1, ' pass: secrets.mailgun.password'); - index = userController.indexOf(' var smtpTransport = nodemailer.createTransport(\'SMTP\', {', 1); + index = userController.indexOf(' var smtpTransport = nodemailer.createTransport(\'SMTP\', {', (index + 1)); userController.splice(index + 1, 1, ' service: \'Mailgun\','); userController.splice(index + 3, 1, ' user: secrets.mailgun.login,'); userController.splice(index + 4, 1, ' pass: secrets.mailgun.password'); @@ -101,7 +101,7 @@ inquirer.prompt({ userController.splice(index + 1, 1, ' service: \'Mandrill\','); userController.splice(index + 3, 1, ' user: secrets.mandrill.login,'); userController.splice(index + 4, 1, ' pass: secrets.mandrill.password'); - index = userController.indexOf(' var smtpTransport = nodemailer.createTransport(\'SMTP\', {', 1); + index = userController.indexOf(' var smtpTransport = nodemailer.createTransport(\'SMTP\', {', (index + 1)); userController.splice(index + 1, 1, ' service: \'Mandrill\','); userController.splice(index + 3, 1, ' user: secrets.mandrill.login,'); userController.splice(index + 4, 1, ' pass: secrets.mandrill.password'); From 0a99a8d58407274c63c77fe99c6fa745cfae3ac8 Mon Sep 17 00:00:00 2001 From: Jake Larson Date: Wed, 23 Apr 2014 13:08:46 -0500 Subject: [PATCH 4/4] Update README.md Added back instagram documentation --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 857b463fca..9ec970e0ce 100644 --- a/README.md +++ b/README.md @@ -308,7 +308,7 @@ The same goes for other providers. - Go to http://mandrill.com - Sign up and add your *Domain Name* -- From the dashboard, click on *Get SMTP credentials +- From the dashboard, click on *Get SMTP credentials - Copy and paste the default SMTP *Login* and *Password* into `config/secrets.js` @@ -372,6 +372,7 @@ List of Packages | github-api | GitHub API library. | | jade | Template engine for Express. | | lastfm | Last.fm API library. | +| instagram-node | Instagram API library. | | less | LESS compiler. Used implicitly by connect-assets. | | lusca | CSRF middleware. | | mongoose | MongoDB ODM. | @@ -383,6 +384,7 @@ List of Packages | passport-github | Sign-in with GitHub plugin. | | passport-google-oauth | Sign-in with Google plugin. | | passport-twitter | Sign-in with Twitter plugin. | +| passport-instagram | Sign-in with Instagram plugin. | | passport-local | Sign-in with Username and Password plugin. | | passport-linkedin-oauth2 | Sign-in with LinkedIn plugin. | | passport-oauth | Allows you to set up your own OAuth 1.0a and OAuth 2.0 strategies. |