向 Flutter 应用的新用户发送欢迎电子邮件 [英] Send welcome email to new users of a Flutter app
问题描述
我有一个带有 Google SignIn 和 Facebook SignIn 的 firebase 身份验证的 Flutter 应用程序.我想向我的应用程序的新用户发送一封电子邮件.如何实施?我需要为此使用哪些服务?
I have a flutter app with firebase authentication of Google SignIn and Facebook SignIn. I want to send an email to the new users of my app. How to implement that? What are the services I need to use for it?
推荐答案
您可以创建云函数触发器,在创建帐户时在用户集合"中创建用户文档.
You can create a cloud function trigger that creates a user document in a "users collection" when the account is created.
export const createUserDoc = functions.auth.user().onCreate(event => {
const firebaseUser = event.data;
const user = {
name: firebaseUser.displayName || "No Name",
email: firebaseUser.email
};
return firebase.firestore()
.collection("users")
.doc(firebaseUser.uid)
.set(user);
});
之后,最简单的设置方法是使用 Firebase 扩展程序发送电子邮件:https://firebase.google.com/products/extensions/firestore-send-email
After that, the easiest way you could get it setup is to use the Firebase Extension to send email: https://firebase.google.com/products/extensions/firestore-send-email
这篇关于向 Flutter 应用的新用户发送欢迎电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!