Fireship · @fireship
Angular 4 Transactional Email with Google Firebase Cloud Functions
Uploaded June 15, 2017 · Length 5:39
Summary
Send transactional email in Angular 4 using Google Cloud Functions and Send Grid.
- angular 4
- transactional email
- google cloud functions
- send grid
- firebase cloud functions
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
In this episode, I'm going to show you
- 0:02
how to send transactional email in
- 0:04
Angular 4 as a background task in the
- 0:07
cloud. To facilitate this, the emails
- 0:10
will be sent with Google Cloud functions
- 0:12
for Firebase and the email service Send
- 0:15
Grid. You can use any email provider you
- 0:17
want, such as Mail Gun or Postmark or
- 0:20
even Gmail, but I chose Send Grid for
- 0:23
this tutorial because they have a solid
- 0:25
helper library and a detailed node
- 0:28
example in their documentation. They
- 0:30
also offer a free trial with no credit
- 0:32
card required, so you can get your API
- 0:34
key and follow along without having to
- 0:36
pay anything out of pocket.
- 0:40
So, what is a cloud function exactly?
- 0:42
Google Cloud Functions is a serverless
- 0:44
architecture that allows you to run
- 0:46
isolated code in a NodeJS runtime as
- 0:50
opposed to deploying your own server
- 0:51
from scratch. It's Google's answer to
- 0:54
AWS Lambda and it's only been available
- 0:57
to the public for less than a year. It's
- 1:00
an awesome tool for Firebase developers
- 1:02
because it allows you to run code in the
- 1:04
background that would otherwise slow
- 1:06
down an Angular app. And email is
- 1:08
definitely one of those tasks that you
- 1:10
want to delegate to its own background
- 1:12
task or micro service.
- 1:15
We can trigger cloud functions in many
- 1:17
different ways, but this lesson will
- 1:19
demonstrate the use of cloud functions
- 1:20
via HTTP.
- 1:23
It's also useful to know that you can
- 1:24
trigger cloud functions on database
- 1:26
rights, storage uploads, authentication
- 1:29
events, and even analytic events, all of
- 1:32
which are common use cases for
- 1:34
transactional email. Some examples
- 1:36
include sending a welcome email to a new
- 1:38
user or sending an email when they've
- 1:42
reached max capacity on file uploads or
- 1:45
some other app limitation like that. I
- 1:47
plan on covering these scenarios in
- 1:49
future videos.
- 1:52
At this point, I'm assuming you have an
- 1:53
Angular app started with the Firebase
- 1:56
tools package installed. Start by
- 1:58
running the Firebase init command and


