{"id":24676419,"url":"https://github.com/nklsw/mailhog-python","last_synced_at":"2025-10-08T09:31:50.974Z","repository":{"id":65131906,"uuid":"582683473","full_name":"nklsw/mailhog-python","owner":"nklsw","description":"A python client for the Mailhog API","archived":false,"fork":false,"pushed_at":"2024-05-05T18:18:19.000Z","size":23,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-16T00:41:44.904Z","etag":null,"topics":["api-client","api-wrapper","docker","docker-compose","mailhog","mailhog-docker","python","python-3","python3","testing-tools"],"latest_commit_sha":null,"homepage":"","language":"Python","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/nklsw.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-27T15:14:37.000Z","updated_at":"2024-07-27T22:02:12.000Z","dependencies_parsed_at":"2024-11-16T00:41:41.969Z","dependency_job_id":"bb4b8e40-7259-4ed7-b05d-54419cd60004","html_url":"https://github.com/nklsw/mailhog-python","commit_stats":{"total_commits":4,"total_committers":3,"mean_commits":"1.3333333333333333","dds":0.5,"last_synced_commit":"fca743044b55097915de2a49e9b1a569497431e5"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nklsw%2Fmailhog-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nklsw%2Fmailhog-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nklsw%2Fmailhog-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nklsw%2Fmailhog-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nklsw","download_url":"https://codeload.github.com/nklsw/mailhog-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235700104,"owners_count":19031671,"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":["api-client","api-wrapper","docker","docker-compose","mailhog","mailhog-docker","python","python-3","python3","testing-tools"],"created_at":"2025-01-26T12:15:01.081Z","updated_at":"2025-10-08T09:31:50.567Z","avatar_url":"https://github.com/nklsw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mailhog-python\n\nA python client for the [Mailhog](https://github.com/mailhog/MailHog) API\n\n\n## Installation\n\nInstall from PyPI \n\n```\npip install mailhog\n```\n\n## Get Started\n\n```python\nfrom mailhog import Mailhog\n\nmailhog = Mailhog() # Defaults to http://localhost:8025\n\n# Get all messages\nmailhog.messages()\n\n# Get all messages with start and limit parameters\nmailhog.messages(start=0, limit=10)\n\n# Search for messages\nmailhog.search('Text contained in the message')\n\n# Search for messages by recipient\nmailhog.search('test@test.com', 'To')\n\n# Search for messages by sender\nmailhog.search('test@test.com', 'From')\n\n# Delete all messages\nmailhog.delete_all()\n\n# Delete a message\nmailhog.delete(messages.items[0])\n```\n\n# API\n##  mailhog.Mailhog\n\u003e Mailhog API client\n#### Parameters\n\n* `host` - The host of the Mailhog API, defaults to `localhost`\n* `port` - The port of the Mailhog API, defaults to `8025`\n\n### Methods\n### `messages(start=0, limit=10)`\n\u003e Get all messages\n\n#### Parameters\n* `start` - The start index of the messages to return, defaults to `0`\n* `limit` - The number of messages to return, defaults to `10`\n\n#### Returns\n* `list` - A list of `mailhog.Message` objects\n\n#### Example\n```python\nfrom mailhog import Mailhog\n\nmailhog = Mailhog()\n\nmessages = mailhog.messages()\n```\n\n### `search(query, kind='containing', start=0, limit=10)`\n\u003e Search for messages\n\n#### Parameters\n* `query` - The query to search for\n* `kind` - The kind of search to perform, defaults to `containing`\n* `start` - The start index of the messages to return, defaults to `0`\n* `limit` - The number of messages to return, defaults to `10`\n\n#### Returns\n* `list` - A list of `mailhog.Message` objects\n\n#### Example\n```python\nfrom mailhog import Mailhog\n\nmailhog = Mailhog()\n\nmessages = mailhog.search('Some Text')\n```\n\n### `delete_all()`\n\u003e Delete all messages\n\n#### Example\n```python\nfrom mailhog import Mailhog\n\nmailhog = Mailhog()\n\nmailhog.delete_all()\n```\n\n### `delete()`\n\u003e Delete a message\n\n#### Example\n```python\nfrom mailhog import Mailhog\n\nmailhog = Mailhog()\nmessages = mailhog.messages()\nmailhog.delete(messages.items[0])\n```\n\n# Datatypes\n##  mailhog.Messages\n\u003e A list of `mailhog.Message` objects\n#### Attributes\n* `total` - The total number of messages\n* `start` - The start index of the messages\n* `count` - The total number of received messages\n* `items` - A list of `mailhog.Message` objects\n\n##  mailhog.Message\n\u003e A message from Mailhog\n#### Attributes\n* `id` - The ID of the message\n* `from_` - A mailhog.Path object containing the sender\n* `to` - A List of mailhog.Path objects containing the recipients\n* `created` - The date the message was created\n* `content` - A mailhog.Content object containing the content of the message\n* `raw`: - The raw message\n* `mime` - A mailhog.MIME object containing the MIME data of the message\n\n#### Methods\n### `get_sender()`\n\u003e Get the sender of the message\n\n#### Returns\n* `str` - The sender of the message\n\n### `get_recipients()`\n\u003e Get the recipients of the message\n\n#### Returns\n* `list` - A list of recipients\n\n### `get_subject()`\n\u003e Get the subject of the message\n\n#### Returns\n* `str` - The subject of the message\n\n##  mailhog.Path\n\u003e A path object\n#### Attributes\n* `relays` - A list of relays\n* `mailbox` - The mailbox\n* `domain` - The domain\n* `params` - The parameters\n\n##  mailhog.Content\n\u003e The content of a message\n#### Attributes\n* `headers` - A Dict of headers of the message\n* `body` - The body of the message\n* `size` - The size of the message\n* `mime` - The MIME type of the message\n\n\n##  mailhog.MIMEBody\n\u003e The body of a MIME message\n#### Attributes\n* `parts` - A list of mailhog.MIMEContent objects\n\n\n##  mailhog.MIMEContent\n\u003e The content of a MIME message\n#### Attributes\n* `headers` - A Dict of headers of the message\n* `body` - The body of the message\n* `size` - The size of the message\n* `mime` - The MIME type of the message\n\n___\n\n## About the Package\n\n### WIP\n\nThis package is still a work in progress. If you find any bugs or have any suggestions, please open an issue on the [GitHub repository](https://github.com/nklsw/mailhog-python)\n\n### Roadmap\n\n- [x] Mailhog API v2 Messages Endpoint\n- [x] Mailhog API v2 Search Endpoint\n- [ ] Mailhog API v2 Jim Endpoint\n- [x] Mailhog API v1 Delete Messages Endpoint\n- [x] Mailhog API v1 Delete Message Endpoint\n\n\n### Local Development\n\nTo install the package locally, run the following commands:\n\n```\ngit clone\ncd mailhog-python\n\npoetry install\n```\n\nTo run a mailhog instance locally, run the following command:\n\n```\ndocker-compose up -d\n```\n\n\n\nTo run the tests, run the following command:\n\n```\npoetry run pytest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnklsw%2Fmailhog-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnklsw%2Fmailhog-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnklsw%2Fmailhog-python/lists"}