在JavaScript中使用电子邮件触发器扩展firebase

在JavaScript中使用电子邮件触发器扩展firebase,javascript,firebase,google-cloud-firestore,Javascript,Firebase,Google Cloud Firestore,我为Firebase添加了电子邮件触发器的扩展。我有这个功能: firestore .collection(“profiledata”) .doc(user.uid) .更新({ 帐户状态:“活动”, }) .然后(()=>{ //在这里,我想输入Firebase代码 props.history.push(“/clients”); }); 但是,当我将Firebase代码放入其中时: firestore .收集gianluca@piersolutions.ca") .添加({ 至:contac

我为Firebase添加了电子邮件触发器的扩展。我有这个功能:

firestore
.collection(“profiledata”)
.doc(user.uid)
.更新({
帐户状态:“活动”,
})
.然后(()=>{
//在这里,我想输入Firebase代码
props.history.push(“/clients”);
});
但是,当我将Firebase代码放入其中时:

firestore
.收集gianluca@piersolutions.ca")
.添加({
至:contact@piersolutions.ca",
信息:{
主题:“来自Firebase的你好!”,
text:“这是电子邮件正文的纯文本部分。”,
},
})
。然后(()=>console.log(“排队等待发送的电子邮件”);
props.history.push(“/clients”);
在我的IDE中看起来是这样的:


我不知道为什么它不允许我把这个代码放在这里!如何修复?

如下所述,要通过扩展发送电子邮件,您需要在“电子邮件文档集合”字段中配置的集合中创建文档

因此,如果此集合名为
mail
,如上例所示,则需要执行以下操作:

firestore.collection("profiledata").doc(user.uid)
    .update({
        accountStatus: "active"
    })
    .then(() => {
        return firestore.collection('mail').add({
            to: ['someone@example.com'],
            message: {
                subject: 'Hello from Firebase!',
                text: 'This is the plaintext section of the email body.',
                html: 'This is the <code>HTML</code> section of the email body.',
            }
        });
    })
    .then(() => {
     
        props.history.push('/clients')

    });

你能分享你的扩展配置吗?您应该向哪个集合发送电子邮件?@RenaudTarnec我已经编辑了我的问题。它已插入firestore集合。但它给出了错误
错误:无法发送电子邮件。应至少有一个收件人。
但我有一个收件人吗?我正在使用触发器电子邮件firebase扩展。看看我的答案。您需要使用在配置扩展时声明的集合吗?是的,我这样做了,我得到了以下错误:
错误:无效登录:535 5.7.139身份验证不成功,对租户禁用了SmtpClientAuthentication。参观https://aka.ms/smtp_auth_disabled 了解更多信息。[CH2PR07CA0052.namprd07.prod.outlook.com]
您在连接电子邮件提供商时遇到问题。我不能帮你更多,因为这是特定于电子邮件提供商。您可以通过以下信息找到更多信息: