{"id":13412698,"url":"https://github.com/sendgrid/sendgrid-go","last_synced_at":"2025-05-12T13:28:40.716Z","repository":{"id":10568964,"uuid":"12774055","full_name":"sendgrid/sendgrid-go","owner":"sendgrid","description":"The Official Twilio SendGrid Golang API Library","archived":false,"fork":false,"pushed_at":"2025-05-05T10:35:58.000Z","size":9817,"stargazers_count":1007,"open_issues_count":32,"forks_count":267,"subscribers_count":196,"default_branch":"main","last_synced_at":"2025-05-05T11:41:55.755Z","etag":null,"topics":["email","go","golang","sendgrid","transactional-emails"],"latest_commit_sha":null,"homepage":"https://sendgrid.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sendgrid.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-09-12T03:31:13.000Z","updated_at":"2025-04-27T05:39:33.000Z","dependencies_parsed_at":"2024-06-18T11:08:21.970Z","dependency_job_id":"2b4885f1-56b7-45b6-a1d4-cec9e20bc95a","html_url":"https://github.com/sendgrid/sendgrid-go","commit_stats":{"total_commits":534,"total_committers":111,"mean_commits":"4.8108108108108105","dds":0.8202247191011236,"last_synced_commit":"574e54c73371f737f02d2dcafc0a5b3f56a2a1e9"},"previous_names":["elbuo8/sendgridgo"],"tags_count":58,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fsendgrid-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fsendgrid-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fsendgrid-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendgrid%2Fsendgrid-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sendgrid","download_url":"https://codeload.github.com/sendgrid/sendgrid-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253747376,"owners_count":21957748,"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":["email","go","golang","sendgrid","transactional-emails"],"created_at":"2024-07-30T20:01:27.996Z","updated_at":"2025-05-12T13:28:40.685Z","avatar_url":"https://github.com/sendgrid.png","language":"Go","readme":"![Twilio SendGrid Logo](twilio_sendgrid_logo.png)\n\n[![Test and Deploy](https://github.com/sendgrid/sendgrid-go/actions/workflows/test-and-deploy.yml/badge.svg)](https://github.com/sendgrid/sendgrid-go/actions/workflows/test-and-deploy.yml)\n[![GoDoc](https://godoc.org/github.com/sendgrid/sendgrid-go?status.svg)](https://godoc.org/github.com/sendgrid/sendgrid-go)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social\u0026label=Follow)](https://twitter.com/sendgrid)\n[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/sendgrid-go.svg)](https://github.com/sendgrid/sendgrid-go/graphs/contributors)\n[![Open Source Helpers](https://www.codetriage.com/sendgrid/sendgrid-go/badges/users.svg)](https://www.codetriage.com/sendgrid/sendgrid-go)\n\n**This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via Go.**\n\nVersion 3.X.X of this library provides full support for all Twilio SendGrid [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) endpoints, including the new [v3 /mail/send](https://sendgrid.com/blog/introducing-v3mailsend-sendgrids-new-mail-endpoint).\n\nThis library represents the beginning of a new path for Twilio SendGrid. We want this library to be community driven and Twilio SendGrid led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-go/issues) and [pull requests](CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests.\n\n**If you need help using SendGrid, please check the [Twilio SendGrid Support Help Center](https://support.sendgrid.com).**\n\n# Table of Contents\n\n* [Installation](#installation)\n* [Quick Start](#quick-start)\n* [Processing Inbound Email](#inbound)\n* [Usage](#usage)\n* [Use Cases](#use-cases)\n* [Announcements](#announcements)\n* [How to Contribute](#contribute)\n* [Troubleshooting](#troubleshooting)\n* [About](#about)\n* [License](#license)\n\n\u003ca name=\"installation\"\u003e\u003c/a\u003e\n# Installation\n\n## Supported Versions\n\nThis library supports the following Go implementations:\n\n* Go 1.14\n* Go 1.15\n* Go 1.16\n* Go 1.17\n* Go 1.18\n* Go 1.19\n\n## Prerequisites\n\n- The Twilio SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-go), to send up to 40,000 emails for the first 30 days, then send 100 emails/day free forever or check out [our pricing](https://sendgrid.com/pricing?source=sendgrid-go).\n\n## Setup Environment Variables\n\nUpdate the development environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys), for example:\n\n```bash\necho \"export SENDGRID_API_KEY='YOUR_API_KEY'\" \u003e sendgrid.env\necho \"sendgrid.env\" \u003e\u003e .gitignore\nsource ./sendgrid.env\n```\n\n## Install Package\n\n`go get github.com/sendgrid/sendgrid-go`\n\n## Dependencies\n\n- [rest](https://github.com/sendgrid/rest)\n\n## Setup Environment Variables\n\n### Initial Setup\n\n```bash\ncp .env_sample .env\n```\n\n### Environment Variable\n\nUpdate the development environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys), for example:\n\n```bash\necho \"export SENDGRID_API_KEY='YOUR_API_KEY'\" \u003e sendgrid.env\necho \"sendgrid.env\" \u003e\u003e .gitignore\nsource ./sendgrid.env\n```\n\n\u003ca name=\"quick-start\"\u003e\u003c/a\u003e\n# Quick Start\n\n## Hello Email\n\nThe following is the minimum needed code to send an email with the [/mail/send Helper](helpers/mail) ([here](examples/helpers/mail/example.go#L32) is a full example):\n\n### With Mail Helper Class\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/sendgrid/sendgrid-go\"\n\t\"github.com/sendgrid/sendgrid-go/helpers/mail\"\n)\n\nfunc main() {\n\tfrom := mail.NewEmail(\"Example User\", \"test@example.com\")\n\tsubject := \"Sending with Twilio SendGrid is Fun\"\n\tto := mail.NewEmail(\"Example User\", \"test@example.com\")\n\tplainTextContent := \"and easy to do anywhere, even with Go\"\n\thtmlContent := \"\u003cstrong\u003eand easy to do anywhere, even with Go\u003c/strong\u003e\"\n\tmessage := mail.NewSingleEmail(from, subject, to, plainTextContent, htmlContent)\n\tclient := sendgrid.NewSendClient(os.Getenv(\"SENDGRID_API_KEY\"))\n\tresponse, err := client.Send(message)\n\tif err != nil {\n\t\tlog.Println(err)\n\t} else {\n\t\tfmt.Println(response.StatusCode)\n\t\tfmt.Println(response.Body)\n\t\tfmt.Println(response.Headers)\n\t}\n}\n```\n\nThe `NewEmail` constructor creates a [personalization object](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html) for you. [Here](examples/helpers/mail/example.go#L28) is an example of how to add to it.\n\n### Without Mail Helper Class\n\nThe following is the minimum needed code to send an email without the /mail/send Helper ([here](examples/mail/mail.go#L47) is a full example):\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/sendgrid/sendgrid-go\"\n\t\"log\"\n\t\"os\"\n)\n\nfunc main() {\n\trequest := sendgrid.GetRequest(os.Getenv(\"SENDGRID_API_KEY\"), \"/v3/mail/send\", \"https://api.sendgrid.com\")\n\trequest.Method = \"POST\"\n\trequest.Body = []byte(` {\n\t\"personalizations\": [\n\t\t{\n\t\t\t\"to\": [\n\t\t\t\t{\n\t\t\t\t\t\"email\": \"test@example.com\"\n\t\t\t\t}\n\t\t\t],\n\t\t\t\"subject\": \"Sending with Twilio SendGrid is Fun\"\n\t\t}\n\t],\n\t\"from\": {\n\t\t\"email\": \"test@example.com\"\n\t},\n\t\"content\": [\n\t\t{\n\t\t\t\"type\": \"text/plain\",\n\t\t\t\"value\": \"and easy to do anywhere, even with Go\"\n\t\t}\n\t]\n}`)\n\tresponse, err := sendgrid.API(request)\n\tif err != nil {\n\t\tlog.Println(err)\n\t} else {\n\t\tfmt.Println(response.StatusCode)\n\t\tfmt.Println(response.Body)\n\t\tfmt.Println(response.Headers)\n\t}\n}\n```\n\n## General v3 Web API Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/sendgrid/sendgrid-go\"\n\t\"log\"\n\t\"os\"\n)\n\nfunc main() {\n\trequest := sendgrid.GetRequest(os.Getenv(\"SENDGRID_API_KEY\"), \"/v3/api_keys\", \"https://api.sendgrid.com\")\n\trequest.Method = \"GET\"\n\n\tresponse, err := sendgrid.API(request)\n\tif err != nil {\n\t\tlog.Println(err)\n\t} else {\n\t\tfmt.Println(response.StatusCode)\n\t\tfmt.Println(response.Body)\n\t\tfmt.Println(response.Headers)\n\t}\n}\n```\n\n\n\u003ca name=\"inbound\"\u003e\u003c/a\u003e\n# Processing Inbound Email\n\nPlease see [our helper](helpers/inbound) for utilizing our Inbound Parse webhook.\n\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\n# Usage\n\n- [Twilio SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html)\n- [Library Usage Docs](USAGE.md)\n- [Example Code](examples)\n- [How-to: Migration from v2 to v3](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html)\n- [v3 Web API Mail Send Helper](helpers/mail/README.md)\n\n\u003ca name=\"use-cases\"\u003e\u003c/a\u003e\n# Use Cases\n\n[Examples of common API use cases](use-cases/README.md), such as how to send an email with a transactional template.\n\n\u003ca name=\"announcements\"\u003e\u003c/a\u003e\n# Announcements\n\nAll updates to this library are documented in our [CHANGELOG](CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-go/releases).\n\n\u003ca name=\"contribute\"\u003e\u003c/a\u003e\n# How to Contribute\n\nWe encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](CONTRIBUTING.md) guide for details.\n\nQuick links:\n\n- [Feature Request](CONTRIBUTING.md#feature-request)\n- [Bug Reports](CONTRIBUTING.md#submit-a-bug-report)\n- [Improvements to the Codebase](CONTRIBUTING.md#improvements-to-the-codebase)\n- [Review Pull Requests](CONTRIBUTING.md#code-reviews)\n\n\u003ca name=\"troubleshooting\"\u003e\u003c/a\u003e\n# Troubleshooting\n\nPlease see our [troubleshooting guide](TROUBLESHOOTING.md) for common library issues.\n\n\u003ca name=\"about\"\u003e\u003c/a\u003e\n# About\n\nsendgrid-go is maintained and funded by Twilio SendGrid, Inc. The names and logos for sendgrid-go are trademarks of Twilio SendGrid, Inc.\n\n\u003ca name=\"support\"\u003e\u003ca\u003e\n# Support\n\nIf you need help using SendGrid, please check the [Twilio SendGrid Support Help Center](https://support.sendgrid.com).\n\n# License\n[The MIT License (MIT)](LICENSE)\n","funding_links":[],"categories":["Go","邮件库","Email","\u003cspan id=\"电子邮件-email\"\u003e电子邮件 Email\u003c/span\u003e","Relational Databases","电子邮件","Repositories","Table of Contents","邮件库`邮件管理和发送的go语言库`","邮件"],"sub_categories":["SQL 查询语句构建库","Advanced Console UIs","Search and Analytic Databases","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","检索及分析资料库","Email Service"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsendgrid%2Fsendgrid-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsendgrid%2Fsendgrid-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsendgrid%2Fsendgrid-go/lists"}