A
A
Abra Kadabra2020-08-17 22:28:56
Google
Abra Kadabra, 2020-08-17 22:28:56

How to send email by trigger in cloud functions?

I got myself a base on firebase, as there is no need for some kind of wide functionality from the back-end, now I’m thinking how best to connect sending emails.
There are 2 chairs ... on one sendgrid, and on the other gmail, which one will you sit on, which client will you put on?:

There is some strange authorization in gmail and it seems to require an account service:

const auth = {
user: [email protected];
password: ...word;
privateKey: ????;
}


I don’t feel very comfortable pushing this data into an object, and then throwing this code into a turnip (closed), in addition to everything, as I understand it, a service account (privateKey) is needed to send via gmail.

In turn, sendgrid allows you to send a letter simply, but why have cloud functions at all if you store 1 data table and send letters through a third-party service, having gmail at your side?

Is there any more adequate way to send a letter through the cloud function, without registering the ak service and without using the left services?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
achubutkin, 2020-08-27
@Jmaster

Firstly, you don’t need to stuff authorization data into the object and into the turnip, for this there is Environment variables in Cloud Functions https://cloud.google.com/functions/docs/env-var
Secondly, you need a service account for Gmail in order to control the access of third-party applications (in this case, this is Firebase). This is actually more convenient than putting your logins and passwords in Environment variables, instead of just a private key.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question