Send E-Mail from Node.js with your GMail account to any e-mail recipient.
Usage explanation
- Get a GMail account from Google
- Google is somewhat restrictive how you ought to send mails,
but there is a way to configure automated sending capabilities.
Go to- "Settings"
- "Accounts and import"
- "Further Settings"
- "Logon and security"
- Activate "Less secure apps"
- Go to your node project folder and type npm install mailsender
- Use mailsender in your Node.js applicaton (copy&paste):
var mailsender = require('mailsender'); mailsender .from('user', 'pass') .to('x@y.z') .body('subject', 'message') .send();
Sending HTML E-Mail
Instead of.body('subject', 'message')above, add a boolean as last argument:
.body('subject', 'message', true)That's it: Your message will be interpreted as HTML now.