Comparing version 1.0.5 to 2.0.0
@@ -16,4 +16,4 @@ { | ||
"ADMIN": "name@domain.com", | ||
"MANDRILL_API_KEY": "you_mandrill_api_key" | ||
"SMTP": "smtp://postmaster%40domain.com:password@smtp.server.com" | ||
} | ||
} |
{ | ||
"MANDRILL_API_KEY": "your_api_key" | ||
"SMTP": "smtp://postmaster%40domain.com:password@smtp.server.com" | ||
} |
{ | ||
"name": "mailhound", | ||
"version": "1.0.5", | ||
"version": "2.0.0", | ||
"description": "Mailhound is a simple server side script for receiving form posts and emailing the form values.", | ||
@@ -28,4 +28,4 @@ "keywords": [ | ||
"express": "^4.11.1", | ||
"mandrill-api": "^1.0.41", | ||
"nconf": "^0.7.1" | ||
"nconf": "^0.7.1", | ||
"nodemailer": "^2.3.2" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
@@ -9,3 +9,3 @@ # mailhound | ||
1. Create an account at [Mandrill](https://mandrill.com) and make note of your api key | ||
1. Create an account with a mail provider like [Mailgun](https://mailgun.com) or [Sendgrid](https://sendgrid.com) | ||
@@ -20,3 +20,3 @@ ### Heroku Install (Free) | ||
1. **ADMIN**: Enter your email | ||
2. **MANDRILL_API_KEY**: Paste in your api key | ||
2. **SMTP**: Your smtp credentials | ||
4. Deploy for **Free**! | ||
@@ -30,3 +30,3 @@ | ||
4. Add config variable exports to the end of your `~/.profile` file | ||
1. `export MANDRILL_API_KEY=your_api_key` | ||
1. `export SMTP=smtp://postmaster:pass@smtp.server.com` | ||
2. `export KEY:name@domain.com` | ||
@@ -33,0 +33,0 @@ 5. Reconnect to SSH and run the script `mailhound` |
@@ -5,3 +5,3 @@ #!/usr/bin/env node | ||
var bodyParser = require('body-parser'); | ||
var mandrill = require('mandrill-api/mandrill'); | ||
var nodemailer = require('nodemailer'); | ||
var nconf = require('nconf'); | ||
@@ -15,3 +15,3 @@ | ||
var mandrill_client = new mandrill.Mandrill(config.get('MANDRILL_API_KEY')); | ||
var transport = nodemailer.createTransport(config.get('SMTP')); | ||
var app = express(); | ||
@@ -66,33 +66,22 @@ | ||
// Create an email message based on post values | ||
var message = { | ||
var mailOpts = { | ||
'text': emailMessage || 'No message was provided', | ||
'subject': req.body._subject || 'Email from mailhound', | ||
'from_email': req.body._replyto || req.body.email, | ||
'from_name': req.body.name, | ||
'to': [ | ||
{ | ||
'email': config.get(req.query.key), | ||
'type': 'to' | ||
}, | ||
{ | ||
'email': req.body._cc, | ||
'type': 'cc' | ||
} | ||
] | ||
'from': { | ||
'name': req.body.name, | ||
'address': req.body._replyto || req.body.email | ||
}, | ||
'to': config.get(req.query.key), | ||
'cc': req.body._cc | ||
} | ||
// Send the message! | ||
mandrill_client.messages.send( | ||
{ | ||
'message': message, | ||
'async': false | ||
}, | ||
function(result) { | ||
res.redirect(req.body._next || req.get('Referrer')); | ||
}, | ||
function(e) { | ||
console.log('Error sending email: ' + e.name + ' - ' + e.message); | ||
res.status(500).send({ error: 'Error sending email' }); | ||
} | ||
); | ||
transport.sendMail(mailOpts, function(err, info) { | ||
if (err) { | ||
console.log('Error sending email: ' + err.name + ' - ' + err.message); | ||
return res.status(500).send({ error: 'Error sending email' }); | ||
} | ||
res.redirect(req.body._next || req.get('Referrer')); | ||
}); | ||
}); | ||
@@ -99,0 +88,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10519
98
+ Addednodemailer@^2.3.2
+ Addedaddressparser@1.0.1(transitive)
+ Addedbuildmail@4.0.1(transitive)
+ Addedhttpntlm@1.6.1(transitive)
+ Addedhttpreq@1.1.1(transitive)
+ Addediconv-lite@0.4.15(transitive)
+ Addedip@1.1.9(transitive)
+ Addedlibbase64@0.1.0(transitive)
+ Addedlibmime@3.0.0(transitive)
+ Addedlibqp@1.1.0(transitive)
+ Addedmailcomposer@4.0.1(transitive)
+ Addednodemailer@2.7.2(transitive)
+ Addednodemailer-direct-transport@3.3.2(transitive)
+ Addednodemailer-fetch@1.6.0(transitive)
+ Addednodemailer-shared@1.1.0(transitive)
+ Addednodemailer-smtp-pool@2.8.2(transitive)
+ Addednodemailer-smtp-transport@2.7.2(transitive)
+ Addednodemailer-wellknown@0.1.10(transitive)
+ Addedpunycode@1.4.1(transitive)
+ Addedsmart-buffer@1.1.15(transitive)
+ Addedsmtp-connection@2.12.0(transitive)
+ Addedsocks@1.1.9(transitive)
+ Addedunderscore@1.7.0(transitive)
- Removedmandrill-api@^1.0.41
- Removedmandrill-api@1.0.45(transitive)