Merge branch 'master' of https://github.com/larsonjj/hackathon-starter into larsonjj-master

pull/2/head
Sahat Yalkabov 2014-04-26 13:42:10 -04:00
commit 929bf7d328
2 changed files with 37 additions and 5 deletions

View File

@ -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`
<hr>
<img src="http://cdn.appstorm.net/web.appstorm.net/web/files/2013/12/mandrill-logo.png" width="100">
- 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
-----------------
@ -602,7 +611,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)
--------------------------

View File

@ -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;
@ -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');
@ -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\', {', (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');
fs.writeFileSync(userControllerFile, userController.join(os.EOL));
console.log('✓ Email Delivery Service has been switched to'.info, 'Mandrill'.help);
}
});
}
@ -1036,4 +1059,4 @@ inquirer.prompt({
}
});
}
});
});