Amit K
Amit K
Jul 29, 2017 · 1 min read

const functions = require(‘firebase-functions’);
const gcs = require(‘@google-cloud/storage’)();
const nodemailer = require(‘nodemailer’);
const gmailEmail = encodeURIComponent(functions.config().gmail.email);
const gmailPassword = encodeURIComponent(functions.config().gmail.password);
const mailTransport = nodemailer.createTransport(`smtps://${gmailEmail}:${@smtp.gmail.com”>gmailPassword}@smtp.gmail.com`);

exports.sendMail = functions.https.onRequest((request, response) => {
const mailOptions = {
to: ‘amit@example.com’,
subject: ‘I love you’,
html: ‘ I love You Bro , — The Universe’
};
mailTransport.sendMail(mailOptions)
.then(() => {
response.send(“mail sent !”)
}).catch((e) => { response.send(‘errr:’,e) });
});

I enabled less secure app enabled + Allow access to your Google account on config gmail account, and bought pay as you go plan , when I run http request with postman ( Post , body raw , application/json ) I got following response :
“Error: could not handle the request”
what possible reason can be ?

    Amit K

    Written by

    Amit K