Skip to content

Latest commit

 

History

History

functions-sendgrid-email

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Gatsby

Gatsby Functions SendGrid Example

🚀 Quick start

  1. Get SendGrid Credentials.

    Create an account on SendGrid and verify a "single sender" email address that the function will use for sending emails.

    Add the following 2 environment variables to a file named .env.development. You'll need these for the function to be able to send emails:

    • SENDGRID_API_KEY: An SendGrid API Key with full access. SendGrid Docs
    • SENDGRID_AUTHORIZED_EMAIL: the "single sender" the email address you verified with SendGrid SendGrid Docs

    Read more about how Gatsby handles .env files and environment variables in the Gatsby Docs

    You'll also want to add these as environment variables when deploying to Gatsby Cloud. Don't forget to add them to the Preview variables if you plan to add a CMS preview integration.

  2. Start developing.

    To get started, run npm install to install all necessary packages.

    cd examples/functions-sendgrid-email
    npm install
    npm run develop
  3. Open the code and start customizing!

    Your site is now running at http://localhost:8000! You can use the UI on the index page to test the functions or directly access them at http://localhost:8000/api/sendgrid

    Edit src/pages/index.js to see your site update in real-time!

  4. Deploy

You can deploy this example on Gatsby Cloud by copying the example into a new repo and connecting that to Gatsby Cloud.