{"id":13571462,"url":"https://github.com/domodwyer/mailyak","last_synced_at":"2025-10-07T11:32:20.208Z","repository":{"id":9401825,"uuid":"61822883","full_name":"domodwyer/mailyak","owner":"domodwyer","description":"An elegant MIME/SMTP email library with support for attachments","archived":false,"fork":false,"pushed_at":"2023-11-01T18:23:52.000Z","size":162,"stargazers_count":348,"open_issues_count":1,"forks_count":75,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-14T19:58:20.097Z","etag":null,"topics":["attachment","email","go","golang","mime","smtp"],"latest_commit_sha":null,"homepage":"","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/domodwyer.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,"governance":null}},"created_at":"2016-06-23T17:10:28.000Z","updated_at":"2025-04-12T09:10:35.000Z","dependencies_parsed_at":"2023-02-17T09:15:32.153Z","dependency_job_id":"f5b87033-7043-4efb-b9c7-2f9f0ee3923c","html_url":"https://github.com/domodwyer/mailyak","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domodwyer%2Fmailyak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domodwyer%2Fmailyak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domodwyer%2Fmailyak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domodwyer%2Fmailyak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/domodwyer","download_url":"https://codeload.github.com/domodwyer/mailyak/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254328384,"owners_count":22052632,"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":["attachment","email","go","golang","mime","smtp"],"created_at":"2024-08-01T14:01:02.205Z","updated_at":"2025-10-07T11:32:15.177Z","avatar_url":"https://github.com/domodwyer.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"[![Build\nStatus](https://travis-ci.org/domodwyer/mailyak.svg?branch=master)](https://travis-ci.org/domodwyer/mailyak)\n[![GoDoc](https://godoc.org/github.com/domodwyer/mailyak?status.svg)](https://godoc.org/github.com/domodwyer/mailyak)\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://assets.itsallbroken.com/github/mailyak-header.png\" /\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003cem\u003eAn elegant MIME mail library with support for attachments\u003c/em\u003e\n\u003c/p\u003e\n\u003cbr /\u003e\u003cbr /\u003e\u003cbr /\u003e\nA simple, easy to use email library for Go (golang).\n\n- Full attachment support (attach anything that implements `io.Reader`)\n- Send to multiple addresses at the same time, including BCC addresses.\n- Supports composing multi-part messages (HTML and plain text emails for older\n  clients)\n- Write templates directly to the email body (implements `io.Writer` for\n  convenience)\n- Production ready - several million emails sent in a production environment\n- SMTP over TLS support, with automatic STARTTLS upgrades for plaintext\n  connections\n\n# Installation\n\nIf you're using  `go mod`:\n\n```bash\ngo get -v github.com/domodwyer/mailyak/v3\n```\n\nOr with `GOPATH`:\n\n```bash\ngo get -v github.com/domodwyer/mailyak\n```\n\n# Usage\n\n```Go\n// Create a new email - specify the SMTP host:port and auth (if needed)\nmail := mailyak.New(\"mail.host.com:25\", smtp.PlainAuth(\"\", \"user\", \"pass\", \"mail.host.com\"))\n\nmail.To(\"dom@itsallbroken.com\")\nmail.From(\"jsmith@example.com\")\nmail.FromName(\"Bananas for Friends\")\n\nmail.Subject(\"Business proposition\")\n\n// mail.HTML() and mail.Plain() implement io.Writer, so you can do handy things like\n// parse a template directly into the email body\nif err := t.ExecuteTemplate(mail.HTML(), \"htmlEmail\", data); err != nil {\n    panic(\" 💣 \")\n}\n\n// Or set the body using a string setter\nmail.Plain().Set(\"Get a real email client\")\n\n// And you're done! \nif err := mail.Send(); err != nil {\n    panic(\" 💣 \")\n}\n```\n\nTo send an attachment:\n```Go\nmail := mailyak.New(\"mail.host.com:25\", smtp.PlainAuth(\"\", \"user\", \"pass\", \"mail.host.com\"))\n\nmail.To(\"dom@itsallbroken.com\")\nmail.From(\"oops@itsallbroken.com\")\nmail.Subject(\"I am a teapot\")\nmail.HTML().Set(\"Don't panic\")\n\n// input can be a bytes.Buffer, os.File, os.Stdin, etc.\n// call multiple times to attach multiple files\nmail.Attach(\"filename.txt\", \u0026input)\n\nif err := mail.Send(); err != nil {\n    panic(\" 💣 \")\n}\n```\n\n# Notes\n\n- Why \"MailYak\"? Because \"MailyMcMailFace\" is annoyingly long to type.\n- You can use a single instance of mailyak to send multiple emails after\n  changing the to/body/whatever fields, avoiding unnecessary allocation/GC\n  pressure.\n- Attachments are read when you call `Send()` to prevent holding onto multiple\n  copies of the attachment in memory (source and email) - this means changing\n  the attachment data between calling `Attach()` and `Send()` will change what's\n  emailed out!\n- For your own sanity you should vendor this, and any other libraries when going\n  into production.\n\n\n### Maintenance Status\n\nThis library is fully maintained. \n\nThe (relatively) small API/scope and many years spent maturing means it doesn't\nreceive frequent code changes any more. Bug fixes are definitely accepted (and\nappreciated!), and you can consider this a stable and maintained library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomodwyer%2Fmailyak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdomodwyer%2Fmailyak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomodwyer%2Fmailyak/lists"}