How to attach file to an email with nodemailer

Include in the var mailOption the key attachments, as follow: var mailOptions = { … attachments: [ { // utf-8 string as an attachment filename: ‘text1.txt’, content: ‘hello world!’ }, { // binary buffer as an attachment filename: ‘text2.txt’, content: new Buffer(‘hello world!’,’utf-8′) }, { // file on disk as an attachment filename: ‘text3.txt’, path: … Read more

Nodemailer/Gmail – What exactly is a refresh token and how do I get one?

Notes by this answer original’s author: So, I finally managed to figure it out. I’m surprised I couldn’t find more ressources about that so for those who need to use Gmail with Nodemailer I found the answer here: http://masashi-k.blogspot.fr/2013/06/sending-mail-with-gmail-using-xoauth2.html Try creating a new User if you already had one and things ain’t working fine. It … Read more

How to send emails with google using nodemailer after Google disabled less sure app option?

At the time of writing, Less Secure Apps is no longer supported by google. And you can’t use your google account password. You’re gonna have to generate a new app password. App passwords only work if 2-step verification is turned on. Follow this steps to get the app password Go to https://myaccount.google.com/security Enable 2FA Create … Read more

POST request not allowed – 405 Not Allowed – nginx, even with headers included

This configuration to your nginx.conf should help you. https://gist.github.com/baskaran-md/e46cc25ccfac83f153bb server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } error_page 404 /404.html; error_page 403 /403.html; # To allow POST on static pages error_page 405 =200 $uri; # … }