Sending email with serverless functions
You can deploy this function on any of the serverless platforms - AWS Lambda, Google Cloud Functions, Azure Functions, Netlify, Cloudflare Workers, etc.
- Create a new function and paste in the following code.
- You will need to add
npm i nodemailer), and follow your platform's instructions on bundling dependencies.
- Obtain Gmail API credentials for your account. You will need
refreshToken. Follow this YouTube tutorial
- Expose these credentials as the follwing environment variables: