{"id":28578270,"url":"https://github.com/digitalocean/sample-functions-python-sendgrid-email","last_synced_at":"2025-06-27T01:32:19.883Z","repository":{"id":48381285,"uuid":"512886211","full_name":"digitalocean/sample-functions-python-sendgrid-email","owner":"digitalocean","description":"Sending emails via Sendgrid API","archived":false,"fork":false,"pushed_at":"2022-10-03T12:05:27.000Z","size":19,"stargazers_count":22,"open_issues_count":3,"forks_count":27,"subscribers_count":97,"default_branch":"main","last_synced_at":"2025-06-11T01:09:25.940Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalocean.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-11T19:35:33.000Z","updated_at":"2025-05-26T03:36:09.000Z","dependencies_parsed_at":"2023-01-19T02:45:53.206Z","dependency_job_id":null,"html_url":"https://github.com/digitalocean/sample-functions-python-sendgrid-email","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/digitalocean/sample-functions-python-sendgrid-email","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-python-sendgrid-email","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-python-sendgrid-email/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-python-sendgrid-email/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-python-sendgrid-email/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalocean","download_url":"https://codeload.github.com/digitalocean/sample-functions-python-sendgrid-email/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-python-sendgrid-email/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262172495,"owners_count":23270026,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-11T01:09:22.914Z","updated_at":"2025-06-27T01:32:19.822Z","avatar_url":"https://github.com/digitalocean.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sample Function: Python \"Sendgrid Emails\"\n\n## Introduction\n\nThis repository contains a sample Sendgrid Email function written in Python. You are able to send an email using Sendgrid's API to email addresses with or without DMARCS. You can deploy it on DigitalOcean's App Platform as a Serverless Function component.\nDocumentation is available at https://docs.digitalocean.com/products/functions.\n\n### Requirements\n\n* You need a DigitalOcean account. If you don't already have one, you can sign up at [https://cloud.digitalocean.com/registrations/new](https://cloud.digitalocean.com/registrations/new).\n* You need a SendGrid account. If you don't already have one, you can sign up at https://signup.sendgrid.com/.\n* You need to create a SendGrid API key with Full Access to connect to your sendgrid account. You can learn more about it at https://docs.sendgrid.com/ui/account-and-settings/api-keys.\n* You need to add your `API_KEY` to the `.env` file to connect to the SendGrid API.\n* To send emails with valid email addresses, you have to set up sender authentication. You can learn more at https://docs.sendgrid.com/glossary/sender-authentication.\n* To send emails to email address with DMARCS, you have to set up domain authentication. You can learn more at https://docs.sendgrid.com/ui/account-and-settings/how-to-set-up-domain-authentication.\n* To deploy from the command line, you will need the [DigitalOcean `doctl` CLI](https://github.com/digitalocean/doctl/releases).\n\n\n## Deploying the Function\n\n```bash\n# clone this repo\ngit clone git@github.com:digitalocean/sample-functions-python-sendgrid-email.git\n```\n\n```\n# deploy the project, using a remote build so that compiled executable matched runtime environment\n\u003e doctl serverless deploy sample-functions-python-sendgrid-email --remote-build\nDeploying 'sample-functions-python-sendgrid-email'\n  to namespace 'fn-...'\n  on host 'https://faas-...'\nSubmitted action 'emails' for remote building and deployment in runtime python:default (id: ...)\n\nDeployed functions ('doctl sls fn get \u003cfuncName\u003e --url' for URL):\n  - sample/emails\n```\n\n## Using the Function\n\n```bash\ndoctl serverless functions invoke sample/emails -p from:user@do.com to:user@gmail.com subject:Sammy content:Good Morning from Sammy.\n```\n```json\n{\n  \"body\": \"email sent\"\n}\n```\n\n### To send an email using curl:\n```\ncurl -X PUT -H 'Content-Type: application/json' {your-DO-app-url} -d '{\"from\":\"user@do.com\", \"to\":\"user@gmail.com\", \"subject\": \"Sammy\", \"content\":\"Good Morning from Sammy!\"}' \n```\n\n### Learn More\n\nYou can learn more about Functions and App Platform integration in [the official App Platform Documentation](https://www.digitalocean.com/docs/app-platform/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalocean%2Fsample-functions-python-sendgrid-email","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalocean%2Fsample-functions-python-sendgrid-email","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalocean%2Fsample-functions-python-sendgrid-email/lists"}