我有一个与firebase连接的有角度的应用程序。到目前为止,我已经完成了数据库和身份验证。但是现在,我只能使用云功能。每当有人预订受益人时,我都会尝试通过nodemailer发送电子邮件。该功能代码大部分是从firebase github函数示例中复制的,如下所示:
'use strict';
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');
// Configure the email transport using the default SMTP transport and a GMail account.
// For other types of transports such as Sendgrid see https://nodemailer.com/transports/
// TODO: Configure the `gmail.email` and `gmail.password` Google Cloud environment variables.
const gmailEmail = functions.config().gmail.email;
const gmailPassword = functions.config().gmail.password;
const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
});
// Sends an email confirmation when a user changes his …Run Code Online (Sandbox Code Playgroud)