谁能帮我这个?我正在尝试使用 Firebase 函数中的 SendGrid 将文件从 Firebase 存储附加到电子邮件。任何帮助将非常感激。我已经做到了这一点:
export const sendEmail2 = functions.https.onCall(async (data, context) => {
if (!context.auth) {
throw new functions.https.HttpsError('failed-precondition', 'You must be logged in!');
}
const toEmail = data.toEmail;
const fromEmail = data.fromEmail;
const subject = data.subject;
const body = data.body;
const msg: any = {
to: toEmail,
from: fromEmail,
subject: subject,
html: body,
};
if (data.cc) {
msg.cc = data.cc;
}
if (data.attachments) {
msg.attachments = [];
let content;
data.attachments.forEach(
async (att: any) => {
const …Run Code Online (Sandbox Code Playgroud)