{"id":13412691,"url":"https://github.com/mailgun/mailgun-go","last_synced_at":"2026-02-23T21:01:04.590Z","repository":{"id":14554716,"uuid":"17270216","full_name":"mailgun/mailgun-go","owner":"mailgun","description":"Go library for the Mailgun API.","archived":false,"fork":false,"pushed_at":"2026-02-10T18:02:08.000Z","size":1090,"stargazers_count":743,"open_issues_count":3,"forks_count":149,"subscribers_count":69,"default_branch":"main","last_synced_at":"2026-02-18T03:02:49.224Z","etag":null,"topics":["email","go","mailgun"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"wcgallego/pecl-gearman","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mailgun.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-02-28T00:28:44.000Z","updated_at":"2026-02-12T03:42:45.000Z","dependencies_parsed_at":"2026-01-08T21:10:02.701Z","dependency_job_id":null,"html_url":"https://github.com/mailgun/mailgun-go","commit_stats":{"total_commits":444,"total_committers":77,"mean_commits":5.766233766233766,"dds":0.7342342342342343,"last_synced_commit":"fa30808420260f928adeb9eb69d5af0dbec33975"},"previous_names":[],"tags_count":120,"template":false,"template_full_name":null,"purl":"pkg:github/mailgun/mailgun-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailgun%2Fmailgun-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailgun%2Fmailgun-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailgun%2Fmailgun-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailgun%2Fmailgun-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mailgun","download_url":"https://codeload.github.com/mailgun/mailgun-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailgun%2Fmailgun-go/sbom","scorecard":{"id":612842,"data":{"date":"2025-08-11","repo":{"name":"github.com/mailgun/mailgun-go","commit":"71719444bcb9d3abfe4838558e41e454fb1e1954"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":2,"reason":"Found 6/26 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":5,"reason":"6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/mailgun/mailgun-go/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/mailgun/mailgun-go/main.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T03:04:49.106Z","repository_id":14554716,"created_at":"2025-08-21T03:04:49.106Z","updated_at":"2025-08-21T03:04:49.106Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29755550,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T20:43:23.829Z","status":"ssl_error","status_checked_at":"2026-02-23T20:43:23.422Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","mailgun"],"created_at":"2024-07-30T20:01:27.901Z","updated_at":"2026-02-23T21:01:04.526Z","avatar_url":"https://github.com/mailgun.png","language":"Go","funding_links":[],"categories":["邮件库","Email","电子邮件","Relational Databases","邮件库`邮件管理和发送的go语言库`"],"sub_categories":["SQL 查询语句构建库","Search and Analytic Databases","检索及分析资料库","Advanced Console UIs"],"readme":"# Mailgun with Go\n\n[![GoDoc](https://godoc.org/github.com/mailgun/mailgun-go?status.svg)](https://godoc.org/github.com/mailgun/mailgun-go/v5)\n[![Build Status](https://github.com/mailgun/mailgun-go/workflows/CI/badge.svg)](https://github.com/mailgun/mailgun-go/actions/workflows/main.yml?query=branch%3Amaster)\n\nGo library for interacting with the [Mailgun](https://mailgun.com/) [API](https://documentation.mailgun.com/).\n\n## Installation\n\nIf you are using [Go Modules](https://go.dev/wiki/Modules) make sure you \ninclude the `/v5` at the end of your import paths\n```bash\ngo get github.com/mailgun/mailgun-go/v5\n```\n\n## Usage\n### Send a message\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/mailgun/mailgun-go/v5\"\n)\n\n// Your available domain names can be found here:\n// (https://app.mailgun.com/app/domains)\nvar yourDomain = \"your-domain-name\" // e.g. mg.yourcompany.com\n\n// You can find Mailgun API keys in your Account Menu, under \"API Security\":\n// (https://app.mailgun.com/settings/api_security)\nvar apiKey = \"MAILGUN_API_KEY\"\n\nfunc main() {\n\t// Create an instance of the Mailgun Client\n\tmg := mailgun.NewMailgun(apiKey)\n\n\t// When you have an EU domain, you must specify the endpoint:\n\t// err := mg.SetAPIBase(mailgun.APIBaseEU)\n\n\tsender := \"sender@example.com\"\n\tsubject := \"Fancy subject!\"\n\tbody := \"Hello from Mailgun Go!\"\n\trecipient := \"recipient@example.com\"\n\n\t// The message object allows you to add attachments and Bcc recipients\n\tmessage := mailgun.NewMessage(yourDomain, sender, subject, body, recipient)\n\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*10)\n\tdefer cancel()\n\n\t// Send the message with a 10-second timeout\n\tresp, err := mg.Send(ctx, message)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\"ID: %s Resp: %s\\n\", resp.ID, resp.Message)\n}\n```\n\n### Get Events\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/mailgun/mailgun-go/v5\"\n\t\"github.com/mailgun/mailgun-go/v5/events\"\n)\n\nfunc main() {\n\t// You can find Mailgun API keys in your Account Menu, under \"API Security\":\n\t// (https://app.mailgun.com/settings/api_security)\n\tmg := mailgun.NewMailgun(\"MAILGUN_API_KEY\")\n\n\tit := mg.ListEvents(\"your-domain.com\", \u0026mailgun.ListEventOptions{Limit: 100})\n\n\tvar page []events.Event\n\n\t// The entire operation should not take longer than 30 seconds\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*30)\n\tdefer cancel()\n\n\t// For each page of 100 events\n\tfor it.Next(ctx, \u0026page) {\n\t\tfor _, e := range page {\n\t\t\t// You can access some fields via the interface\n\t\t\tfmt.Printf(\"Event: '%s' TimeStamp: '%s'\\n\", e.GetName(), e.GetTimestamp())\n\n\t\t\t// and you can act upon each event by type\n\t\t\tswitch event := e.(type) {\n\t\t\tcase *events.Accepted:\n\t\t\t\tfmt.Printf(\"Accepted: auth: %t\\n\", event.Flags.IsAuthenticated)\n\t\t\tcase *events.Delivered:\n\t\t\t\tfmt.Printf(\"Delivered transport: %s\\n\", event.Envelope.Transport)\n\t\t\tcase *events.Failed:\n\t\t\t\tfmt.Printf(\"Failed reason: %s\\n\", event.Reason)\n\t\t\tcase *events.Clicked:\n\t\t\t\tfmt.Printf(\"Clicked GeoLocation: %s\\n\", event.GeoLocation.Country)\n\t\t\tcase *events.Opened:\n\t\t\t\tfmt.Printf(\"Opened GeoLocation: %s\\n\", event.GeoLocation.Country)\n\t\t\tcase *events.Rejected:\n\t\t\t\tfmt.Printf(\"Rejected reason: %s\\n\", event.Reject.Reason)\n\t\t\tcase *events.Stored:\n\t\t\t\tfmt.Printf(\"Stored URL: %s\\n\", event.Storage.URL)\n\t\t\tcase *events.Unsubscribed:\n\t\t\t\tfmt.Printf(\"Unsubscribed client OS: %s\\n\", event.ClientInfo.ClientOS)\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\n### Event Polling\nThe mailgun library has built-in support for polling the events api\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/mailgun/mailgun-go/v5\"\n\t\"github.com/mailgun/mailgun-go/v5/events\"\n)\n\nfunc main() {\n\t// You can find Mailgun API keys in your Account Menu, under \"API Security\":\n\t// (https://app.mailgun.com/settings/api_security)\n\tmg := mailgun.NewMailgun(\"MAILGUN_API_KEY\")\n\n\tbegin := time.Now().Add(time.Second * -3)\n\n\t// Very short poll interval\n\tit := mg.PollEvents(\"your-domain.com\", \u0026mailgun.ListEventOptions{\n\t\t// Only events with a timestamp after this date/time will be returned\n\t\tBegin: begin,\n\t\t// How often we poll the api for new events\n\t\tPollInterval: time.Second * 30,\n\t})\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\t// Poll until our email event arrives\n\tvar page []events.Event\n\tfor it.Poll(ctx, \u0026page) {\n\t\tfor _, e := range page {\n\t\t\tlog.Printf(\"Got an event: %q (%q)\", e.GetName(), e.GetID())\n\t\t\t// Do something with event\n\t\t}\n\t}\n}\n```\n\n### Email Validations\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/mailgun/mailgun-go/v5\"\n)\n\n// Your plan should include email validations.\n// Use your Mailgun API key. You can find the Mailgun API keys in your Account Menu, under \"Settings\":\n// (https://app.mailgun.com/settings/api_security)\nvar apiKey = \"MAILGUN_API_KEY\"\n\nfunc main() {\n\t// Create an instance of the Validator\n\tmg := mailgun.NewMailgun(\"MAILGUN_API_KEY\")\n\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*10)\n\tdefer cancel()\n\n\temail, err := mg.ValidateEmail(ctx, \"recipient@example.com\", false)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"Risk: %t\\n\", email.Risk)\n}\n```\n\n### Webhook Handling\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\n\t\"github.com/mailgun/mailgun-go/v5\"\n\t\"github.com/mailgun/mailgun-go/v5/events\"\n\t\"github.com/mailgun/mailgun-go/v5/mtypes\"\n)\n\nfunc main() {\n\t// You can find Mailgun API keys in your Account Menu, under \"API Security\":\n\t// (https://app.mailgun.com/settings/api_security)\n\tmg := mailgun.NewMailgun(\"MAILGUN_API_KEY\")\n\tmg.SetWebhookSigningKey(\"WEBHOOK_SIGNING_KEY\")\n\n\thttp.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tvar payload mtypes.WebhookPayload\n\t\tif err := json.NewDecoder(r.Body).Decode(\u0026payload); err != nil {\n\t\t\tfmt.Printf(\"decode JSON error: %s\", err)\n\t\t\tw.WriteHeader(http.StatusNotAcceptable)\n\t\t\treturn\n\t\t}\n\n\t\tverified, err := mg.VerifyWebhookSignature(payload.Signature)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"verify error: %s\\n\", err)\n\t\t\tw.WriteHeader(http.StatusNotAcceptable)\n\t\t\treturn\n\t\t}\n\n\t\tif !verified {\n\t\t\tw.WriteHeader(http.StatusNotAcceptable)\n\t\t\tfmt.Printf(\"failed verification %+v\\n\", payload.Signature)\n\t\t\treturn\n\t\t}\n\n\t\tfmt.Printf(\"Verified Signature\\n\")\n\n\t\t// Parse the event provided by the webhook payload\n\t\te, err := events.ParseEvent(payload.EventData)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"parse event error: %s\\n\", err)\n\t\t\treturn\n\t\t}\n\n\t\tswitch event := e.(type) {\n\t\tcase *events.Accepted:\n\t\t\tfmt.Printf(\"Accepted: auth: %t\\n\", event.Flags.IsAuthenticated)\n\t\tcase *events.Delivered:\n\t\t\tfmt.Printf(\"Delivered transport: %s\\n\", event.Envelope.Transport)\n\t\t}\n\t})\n\n\tfmt.Println(\"Serve on :9090...\")\n\tif err := http.ListenAndServe(\":9090\", nil); err != nil {\n\t\tfmt.Printf(\"serve error: %s\\n\", err)\n\t\tos.Exit(1)\n\t}\n}\n```\n\n### Sending HTML templates\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/mailgun/mailgun-go/v5\"\n)\n\n// Your available domain names can be found here:\n// (https://app.mailgun.com/app/domains)\nvar yourDomain = \"your-domain-name\" // e.g. mg.yourcompany.com\n\n// You can find Mailgun API keys in your Account Menu, under \"API Security\":\n// (https://app.mailgun.com/settings/api_security)\nvar apiKey = \"MAILGUN_API_KEY\"\n\nfunc main() {\n\t// Create an instance of the Mailgun Client\n\tmg := mailgun.NewMailgun(apiKey)\n\n\tsender := \"sender@example.com\"\n\tsubject := \"HTML email!\"\n\trecipient := \"recipient@example.com\"\n\n\tmessage := mailgun.NewMessage(yourDomain, sender, subject, \"\", recipient)\n\tbody := `\n\u003chtml\u003e\n\u003cbody\u003e\n\t\u003ch1\u003eSending HTML emails with Mailgun\u003c/h1\u003e\n\t\u003cp style=\"color:blue; font-size:30px;\"\u003eHello world\u003c/p\u003e\n\t\u003cp style=\"font-size:30px;\"\u003eMore examples can be found \u003ca href=\"https://documentation.mailgun.com/en/latest/api-sending.html#examples\"\u003ehere\u003c/a\u003e\u003c/p\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n`\n\n\tmessage.SetHTML(body)\n\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*10)\n\tdefer cancel()\n\n\t// Send the message with a 10-second timeout\n\tresp, err := mg.Send(ctx, message)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\"ID: %s Resp: %s\\n\", resp.ID, resp.Message)\n}\n```\n\n### Using Templates\n\nTemplates enable you to create message templates on your Mailgun account and then populate the data variables at send-time. This allows you to have your layout and design managed on the server and handle the data on the client. The template variables are added as a JSON stringified `X-Mailgun-Variables` header. For example, if you have a template to send a password reset link, you could do the following:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/mailgun/mailgun-go/v5\"\n)\n\n// Your available domain names can be found here:\n// (https://app.mailgun.com/app/domains)\nvar yourDomain = \"your-domain-name\" // e.g. mg.yourcompany.com\n\n// You can find Mailgun API keys in your Account Menu, under \"API Security\":\n// (https://app.mailgun.com/settings/api_security)\nvar apiKey = \"MAILGUN_API_KEY\"\n\nfunc main() {\n\t// Create an instance of the Mailgun Client\n\tmg := mailgun.NewMailgun(apiKey)\n\n\tsender := \"sender@example.com\"\n\tsubject := \"Fancy subject!\"\n\tbody := \"\"\n\trecipient := \"recipient@example.com\"\n\n\t// The message object allows you to add attachments and Bcc recipients\n\tmessage := mailgun.NewMessage(yourDomain, sender, subject, body, recipient)\n\tmessage.SetTemplate(\"passwordReset\")\n\terr := message.AddTemplateVariable(\"passwordResetLink\", \"some link to your site unique to your user\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*10)\n\tdefer cancel()\n\n\t// Send the message with a 10-second timeout\n\tresp, err := mg.Send(ctx, message)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\"ID: %s Resp: %s\\n\", resp.ID, resp.Message)\n}\n```\n\nThe official mailgun documentation includes examples using this library. Go\n[here](https://documentation.mailgun.com/docs/mailgun/sdk/go_sdk).\n\n## EU Region\nEuropean customers will need to change the default API Base to access your domains\n\n```go\nmg := mailgun.NewMailgun(\"MAILGUN_API_KEY\")\nmg.SetAPIBase(mailgun.APIBaseEU)\n```\n\n## Major Version Migration Notes\nWe are trying to keep breaking changes to a minimum, but sometimes they are necessary.\n\nWe are guaranteeing that there will be no breaking changes within a major version.\n\n### v4 to v5 Migration\nList of changes are in [Release v5.0.0](https://github.com/mailgun/mailgun-go/releases/tag/v5.0.0).\n\n#### How to migrate\n1. Upgrade to [the latest v4 release (v4.23.0)](https://github.com/mailgun/mailgun-go/releases/tag/v4.23.0) first.\n1. Get rid of all deprecated code usage. \n   We recommend using [staticcheck linter SA1019 check](https://staticcheck.dev/docs/checks/#SA1019) for that\n   (or just look for `// Deprecated:` comments in the code) and follow the recommendations there.\n   This should make the major version bump go more smoothly.\n1. Update your import paths to use `/v5` at the end, e.g.\n   ```go\n   import \"github.com/mailgun/mailgun-go/v5\"\n   ```\n\n## Testing\n\n*WARNING* - running the tests will cost you money!\n\nTo run the tests various environment variables must be set. These are:\n\n* `MG_DOMAIN` is the domain name - this is a value registered in the Mailgun admin interface.\n* `MG_API_KEY` is the Private API key - you can get this value from the Mailgun [security page](https://app.mailgun.com/settings/api_security)\n* `MG_EMAIL_TO` is the email address used in various sending tests.\n\nand finally\n\n* `MG_SPEND_MONEY` if this value is set the part of the test that use the API to actually send email will be run - be aware *this will count on your quota* and *this _will_ cost you money*.\n\nThe code is released under a 3-clause BSD license. See the LICENSE file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailgun%2Fmailgun-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmailgun%2Fmailgun-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailgun%2Fmailgun-go/lists"}