How to send email using cloud function after a pub/sub event trigger

Rajathithan Rajasekar
2 min readJul 30, 2023
Photo by Kelly Sikkema on Unsplash

In this post, we are going to see how to send email from cloud function using a customized html template by listening to a pub/sub event .

Let’s take a scenario of notifying the completion of storage transfer service Job , So when the data transfer from AWS S3 to GCP GCS gets completed, it should send an email to the respective team notifying them about the completion of transfer.

The storage transfer service job should be configured to send a message to a Pub/Sub topic and Later we have to create a cloud function subscribed to that pubsub topic.

When the transfer completion event gets posted to the pubsub topic, it will trigger the cloud function, in turn the cloud function will send the status via email to the respective teams.

There are google documentations available on how to have a cloud function subscribe to a pub/sub topic and how to send an email after a pub/sub event from cloud function.

--

--

Rajathithan Rajasekar

I like to write code in Python . Interested in cloud , dataAnalysis, computerVision, ML and deepLearning. https://rajathithanrajasekar.medium.com/membership