{"id":15404554,"url":"https://github.com/k1low/smtptest","last_synced_at":"2025-04-16T21:29:48.829Z","repository":{"id":39397448,"uuid":"480221660","full_name":"k1LoW/smtptest","owner":"k1LoW","description":"smtptest provides SMTP server for testing.","archived":false,"fork":false,"pushed_at":"2025-03-13T04:35:23.000Z","size":63,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T05:41:34.444Z","etag":null,"topics":["go","mail","smtp","testing"],"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/k1LoW.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"k1LoW","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2022-04-11T04:07:14.000Z","updated_at":"2025-03-13T04:35:15.000Z","dependencies_parsed_at":"2024-02-22T12:30:26.275Z","dependency_job_id":"b91435e8-5690-4c1e-aef0-e133c92d4959","html_url":"https://github.com/k1LoW/smtptest","commit_stats":{"total_commits":25,"total_committers":2,"mean_commits":12.5,"dds":0.07999999999999996,"last_synced_commit":"bdadd13096759f2cf1c2c610269b5f2d72e1e0c3"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fsmtptest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fsmtptest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fsmtptest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fsmtptest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k1LoW","download_url":"https://codeload.github.com/k1LoW/smtptest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249279083,"owners_count":21242844,"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":["go","mail","smtp","testing"],"created_at":"2024-10-01T16:13:40.219Z","updated_at":"2025-04-16T21:29:48.796Z","avatar_url":"https://github.com/k1LoW.png","language":"Go","funding_links":["https://github.com/sponsors/k1LoW"],"categories":[],"sub_categories":[],"readme":"# smtptest [![build](https://github.com/k1LoW/smtptest/actions/workflows/ci.yml/badge.svg)](https://github.com/k1LoW/smtptest/actions/workflows/ci.yml) ![Coverage](https://raw.githubusercontent.com/k1LoW/octocovs/main/badges/k1LoW/smtptest/coverage.svg) ![Code to Test Ratio](https://raw.githubusercontent.com/k1LoW/octocovs/main/badges/k1LoW/smtptest/ratio.svg) ![Test Execution Time](https://raw.githubusercontent.com/k1LoW/octocovs/main/badges/k1LoW/smtptest/time.svg)\n\n`smtptest` provides SMTP server for testing.\n\n## Usage\n\n``` go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/smtp\"\n\t\"strings\"\n\t\"testing\"\n\n\t\"github.com/k1LoW/smtptest\"\n)\n\nconst testMsg = \"To: alice@example.net\\r\\n\" +\n\t\"Subject: Hello Gophers!\\r\\n\" +\n\t\"\\r\\n\" +\n\t\"This is the email body.\\r\\n\"\n\nfunc TestSendMail(t *testing.T) {\n\tts, auth, err := smtptest.NewServerWithAuth()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tt.Cleanup(func() {\n\t\tts.Close()\n\t})\n\n\taddr := ts.Addr()\n\tif err := smtp.SendMail(addr, auth, \"sender@example.org\", []string{\"alice@example.net\"}, []byte(testMsg)); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(ts.Messages()) != 1 {\n\t\tt.Errorf(\"got %v\\nwant %v\", len(ts.Messages()), 1)\n\t}\n\tmsgs := ts.Messages()\n\n\tgot := msgs[0].Header.Get(\"To\")\n\twant := \"alice@example.net\"\n\tif got != want {\n\t\tt.Errorf(\"got %v\\nwant %v\", got, want)\n\t}\n}\n```\n\n## References\n\n- https://github.com/influxdata/kapacitor/tree/master/services/smtp/smtptest\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk1low%2Fsmtptest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk1low%2Fsmtptest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk1low%2Fsmtptest/lists"}