【发布时间】:2021-08-18 14:51:33
【问题描述】:
我正在开发一个向客户发送电子邮件的功能。
exports.sendRestockingNotification = functions.https.onCall((data) => {
try {
console.log("Sending confirmation email to the customer...");
sendEmailRestocking(data.numero, data.nombre, data.emails);
} catch (error) {
console.error("Unexpected error: ", error);
}
});
function sendEmailRestocking (numero, nombre, emails) {
console.log("Sending Email...");
return transport.sendMail({
from: "XXXXX <xxxxxxxxxxxxx@gmail.com>",
to: emails,
subject: "El artículo " + nombre + " (" + numero + ") vuelve a estar disponible.",
html:
`
<div class="container rounded" style="padding: 10px 30px;">
<div class="container rounded" style="background-color: #0bbe83;">
<h1 style="color: white; padding: 5px;">TejidosPulido</h1>
</div>
<div class="row" style="padding: 10px 50px;">
<h5 style="color: #0bbe83;">Hola, </h5>
<p>
El artículo ${nombre} (${numero}) vuelve a estar disponible. ¡Date prisa antes de que se termine!
</p>
</div>
<br>
<p style="padding: 10px 30px;">
Un saludo,
<br>
Tu equipo TejidosPulido
</p>
</div>
`,
});
}
但我总是在 Firebase Functions 控制台中得到相同的结果,并且发送了任何邮件,并且调试消息 console.log("Sending a confirmation email to the customer..."); 也没有显示:
sendRestockingNotification ->函数执行开始
sendRestockingNotification -> 函数执行耗时 14 毫秒,完成状态码:204
【问题讨论】:
标签: node.js firebase google-cloud-functions nodemailer