Firestore + Swift;触发电子邮件扩展 [英] Firestore + Swift; trigger email extension

查看:75
本文介绍了Firestore + Swift;触发电子邮件扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于Cloud Firestore的iOS应用.我已经阅读了firebase提供的文档,但是我仍然不确定如何将其用于快速编程.有人知道或有使用swiftui应用程序执行此Firebase tigger函数的经验吗?我该如何实施?

I have an iOS app that I'm using with Cloud Firestore. I've read the documentation provided by firebase but I'm still unsure how this can be used with swift programming. Does anyone know or have experience with this firebase tigger function implementation with a swiftui app? How can I implement this?

推荐答案

您可以使用

You can use the Trigger Email Extension to send an email when you add a new document to a Firestore collection.

要使用此功能,您必须:

To use this, you'll have to:

  1. 通过控制台将扩展程序安装到Firebase项目中(请参见此处的说明)
  2. 将新文档添加到您在设置扩展名时指定的集合中.以下是一些示例代码,展示了如何在Swift中执行此操作:

db.collection("mail").addDocument(data: [
    "to": "someone@example.com",
    "message": [
      "subject": "Hello from Firebase",
      "html": "This is an <code>HTML</code> email body."
    ]
]) { err in
    if let err = err {
        print("Error writing document: \(err)")
    } else {
        print("Document successfully written!")
    }
}

这篇关于Firestore + Swift;触发电子邮件扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆