【发布时间】:2021-04-13 02:07:33
【问题描述】:
我为 Firebase 添加了电子邮件触发器的扩展。我有这个功能:
firestore
.collection("profiledata")
.doc(user.uid)
.update({
accountStatus: "active",
})
.then(() => {
//here, I want to put the Firebase code
props.history.push("/clients");
});
但是,当我将 Firebase 代码放入其中时:
firestore
.collection("gianluca@piersolutions.ca")
.add({
to: "contact@piersolutions.ca",
message: {
subject: "Hello from Firebase!",
text: "This is the plaintext section of the email body.",
},
})
.then(() => console.log("Queued email for delivery!"));
props.history.push("/clients");
在我的 IDE 中看起来像这样:
我不知道为什么它不允许我把这段代码放在这里!我该如何解决?
【问题讨论】:
-
你能分享你的扩展配置吗?您应该写入哪个集合以触发电子邮件发送?
-
@RenaudTarnec 我实际上已经编辑了我的问题。它插入到firestore集合中。但它给出了错误
Error: Failed to deliver email. Expected at least 1 recipient.但我有一个收件人?我正在使用触发电子邮件 firebase 扩展。 firebase.google.com/products/extensions/firestore-send-email -
看我的回答。配置扩展时需要使用自己声明的集合吗?
标签: javascript firebase google-cloud-firestore