我正在尝试使用来自firebase云功能的Mailgun的api发送电子邮件.我已经尝试在Cloud Function中实现了相同的nodejs教程,但我总是得到"错误:无法处理请求".请问我做错了什么.
云功能代码如下:
<pre>
<code>
var functions = require('firebase-functions');
var nodemailer = require('nodemailer');
var auth = {
auth: {
api_key: '###################',
domain: 's###############g'
}
}
exports.helloWorld = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
var nodemailerMailgun = nodemailer.createTransport(auth);
exports.sendEmail = functions.https.onRequest((request, response) =>{
//app.get('/', function(req, res) {
test();
});
function test(){
const mailOptions = {
//Specify email data
from: "info@xyz.com",
//The email to contact
to: "xyz@yahoo.com",
//Subject and text data
subject: 'Hello from Mailgun',
text: 'Hello, This is not …Run Code Online (Sandbox Code Playgroud)