This project serves as a serverless function that sends emails
clone this repository on the command line with:
git clone https://github.com/98labs/serverless-gmail-function.git
install node js from https://nodejs.org/en/download/
Obtain your keyfile
- Go to Google Console > APIs & Services > Credentials
- Click create credentials > Service account key
Obtain your Client ID and Client Secret
-
Go to Google Console > API's & Services > Credentials
-
Create credentials > OAuth client ID
-
Select web application, copy paste the following URI's under Authorized redirect URI's:
-
Create
-
Copy Client ID and Client Secret
Obtain your Refresh token
- Go to OAuth Playground
- Open settings (upper right hand corner)
- Check Use your own OAuth credentials and enter the client ID and Client secret obtained before
- Click on 'gmail' or enter mail.google.com in the textbox, and click authorize APIs.
- Click 'Exchange authorization code for tokens' and obtain your refresh token and access token
- input your necessary values into the environment.yml file
- change project name under provider in serverless.yml to your project name
- copy your keyfile into the project and rename into keyfile.json
deploy application with
serverless deploy