{"id":15394868,"url":"https://github.com/nilslice/email","last_synced_at":"2025-04-15T01:03:36.626Z","repository":{"id":57485574,"uuid":"73134676","full_name":"nilslice/email","owner":"nilslice","description":"Minimal SMTP client in Go. Handles MX lookup, mail server connection on common ports. ","archived":false,"fork":false,"pushed_at":"2018-11-11T19:00:02.000Z","size":9,"stargazers_count":102,"open_issues_count":1,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-15T01:03:22.044Z","etag":null,"topics":["dns","email","go","golang","mx-lookup","smtp","smtp-client"],"latest_commit_sha":null,"homepage":null,"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/nilslice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-08T00:50:05.000Z","updated_at":"2024-01-09T20:43:18.000Z","dependencies_parsed_at":"2022-09-08T17:30:33.191Z","dependency_job_id":null,"html_url":"https://github.com/nilslice/email","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilslice%2Femail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilslice%2Femail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilslice%2Femail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilslice%2Femail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nilslice","download_url":"https://codeload.github.com/nilslice/email/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986313,"owners_count":21194025,"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":["dns","email","go","golang","mx-lookup","smtp","smtp-client"],"created_at":"2024-10-01T15:24:46.197Z","updated_at":"2025-04-15T01:03:36.604Z","avatar_url":"https://github.com/nilslice.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Email\n\nI needed a way to send email from a [Ponzu](https://ponzu-cms.org) installation \nrunning on all kinds of systems without shelling out. `sendmail` or `postfix` et \nal are not standard on all systems, and I didn't want to force users to add API \nkeys from a third-party just to send something like an account recovery email. \n\n### Usage:\n`$ go get github.com/nilslice/email`\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/nilslice/email\"\n)\n\nfunc main() {\n    msg := email.Message{\n        To: \"you@server.name\", // do not add \u003c \u003e or name in quotes\n        From: \"me@server.name\", // do not add \u003c \u003e or name in quotes\n        Subject: \"A simple email\",\n        Body: \"Plain text email body. HTML not yet supported, but send a PR!\",\n    }\n\n    err := msg.Send()\n    if err != nil {\n        fmt.Println(err)\n    }\n}\n\n```\n\n### Under the hood\n`email` looks at a `Message`'s `To` field, splits the string on the @ symbol and \nissues an MX lookup to find the mail exchange server(s). Then it iterates over \nall the possibilities in combination with commonly used SMTP ports for non-SSL\nclients: `25, 2525, \u0026 587`\n\nIt stops once it has an active client connected to a mail server and sends the\ninitial information, the message, and then closes the connection.\n\nCurrently, this doesn't support any additional headers or `To` field formatting\n(the recipient's email must be the only string `To` takes). Although these would\nbe fairly strightforward to implement, I don't need them yet.. so feel free to \ncontribute anything you find useful.\n\n#### Warning\nBe cautious of how often you run this locally or in testing, as it's quite \nlikely your IP will be blocked/blacklisted if it is not already. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilslice%2Femail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnilslice%2Femail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilslice%2Femail/lists"}