
Trigger Email

Made by Firebase
指定した Cloud Firestore コレクションに書き込まれたドキュメントのコンテンツに基づいて、メールを生成し送信します。
この拡張機能の動作
Use this extension to render and send emails that contain the information from documents added to a specified Cloud Firestore collection.
Adding a document triggers this extension to send an email built from the document's fields. The document's top-level fields specify the email sender and recipients, including
to
,
cc
, and
bcc
options (each supporting UIDs). The document's
message
field specifies the other email elements, like subject line and email body (either plaintext or HTML)
Here's a basic example document write that would trigger this extension:
admin.firestore().collection('mail').add({
to: 'someone@example.com',
message: {
subject: 'Hello from Firebase!',
html: 'This is an <code>HTML</code> email body.',
},
})
You can also optionally configure this extension to render emails using Handlebar templates. Each template is a document stored in a Cloud Firestore collection.
When you configure this extension, you'll need to supply your SMTP credentials for mail delivery . Note that this extension is for use with bulk email service providers, like SendGrid, Mailgun, etc.
Additional setup
Before installing this extension, make sure that you've set up a Cloud Firestore database in your Firebase project.
Billing
To install an extension, your project must be on the Blaze (pay as you go) plan
- You will be charged a small amount (typically around $0.01/month) for the Firebase resources required by this extension (even if it is not used).
- This extension uses other Firebase and Google Cloud Platform services, which have associated charges if you exceed the service’s no-cost tier:
- Cloud Firestore
- Cloud Functions (Node.js 10+ runtime. See FAQs )
Usage of this extension also requires you to have SMTP credentials for mail delivery. You are responsible for any associated costs with your usage of your SMTP provider.
この拡張機能をインストールする方法
Firebase CLI の使用
拡張機能のインストールと管理は、Firebase CLI でも行えます。
ステップ 1: 以下の npm コマンドを実行して、CLI をインストールするか、最新バージョンの CLI に更新します。
npm install -g firebase-tools正常に機能しない場合は、 Firebase CLI リファレンス を確認するか、 npm のアクセス権 を変更してください。
ステップ 2: 新しい Firebase プロジェクトのディレクトリを設定 するか、既存のプロジェクト ディレクトリに移動します
ステップ 3: 次を実行して、この拡張機能を 拡張機能のマニフェスト に追加します
firebase ext:install firebase/firestore-send-email --local --project=projectId_or_alias
ステップ 4(任意): Firebase Emulator Suite を使用して、この拡張機能をローカルでテストします
firebase emulators:start
ステップ 5: マニフェストにある拡張機能をプロジェクトに デプロイ します
firebase deploy --only extensions --project=projectId_or_alias