我也有这个问题,但是已经解决了。这是你的答案:
“电子邮件文档集合”是将被读取以触发电子邮件的集合。除非您已经有一个名为 mail 的集合,否则我建议您保留名为“mail”的名称。
“用户集合(可选)”是指您希望与用户身份验证系统一起使用的集合(如果有)。我还没有这个具体的用例,但我想一旦你了解了触发电子邮件的运作方式,它应该是不言自明的。
“模板集合(可选)”对于您可以使用的模板很有帮助,handlebar.js 会自动为每个用户输入特定信息。 (例如<p>Hello, {{first_name}}</p> 等)与前面提到的集合类似,您可以随意命名。
如何创建一个模板(我还没有真正实现它,所以对它持保留态度):
在您的模板集合中,您希望使用一个容易记住的 ID 来命名每个文档。 Firebase 给出了例子:
{
subject: "@{{username}} is now following you!",
html: "Just writing to let you know that <code>@{{username}}</code> ({{name}}) is now following you.",
attachments: [
{
filename: "{{username}}.jpg",
path: "{{imagePath}}"
}
]
}
...指定一个好的 ID 将是 following。如您所见,文档的结构应该与您发送的任何其他电子邮件一样。
这是在 javascript 中使用上述模板的示例:
firestore()
.collection("mail")
.add({
toUids: ["abc123"], // This relates to the Users Collection
template: {
name: "following", // Specify the template
// Specify the information for the Handlebars
// which can also be pulled from your users (toUids)
// if you have the data stored in a user collection.
// Of course that gets more into the world of a user auth system.
data: {
username: "ada",
name: "Ada Lovelace",
imagePath: "https://path-to-file/image-name.jpg"
},
},
})
我希望这会有所帮助。如果您在进行此设置时遇到问题,请告诉我。