Create a Contact Form in Angular using Cloud Functions for Firebase
Mark Goho
117

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 ?

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.