tderflinger / serverless-message

Serverless function for sending a contact form information email.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

serverless-message

This is the example application for my blog article. You can find the article here:

It uses the Serverless framework to build a serverless function. The function sends an email to the configured email address with the customer contact information.

The application uses Twilio Sendgrid for sending the email.

Install

Install according to the Serverless installation instructions:

Then run after cloning this repository:

npm install

Set the environmental variables in serverless.yml according to your values.

For example:

export SENDGRID_API_KEY=xxxx
export MESSAGE_TO=your@x.com
export MESSAGE_FROM=website@yourwebsite.com

You can get your Sendgrid API key by signing up at: https://sendgrid.com/

Offline Testing

sls offline

Deploy

sls deploy

Note, after deploying there are costs associated with invoking the function depending on cloud provider.

Remove

sls remove

Notice

If internal server error occurs, run before deploy:

chmod -R +r node_modules/

License

MIT

About

Serverless function for sending a contact form information email.

License:MIT License


Languages

Language:JavaScript 100.0%