LocalStack Mailhog Extension
===============================
[](https://app.localstack.cloud/extensions/remote?url=git+https://github.com/localstack/localstack-extensions/#egg=localstack-extension-mailhog&subdirectory=mailhog)
Web and API based SMTP testing directly in LocalStack using [MailHog](https://github.com/mailhog/MailHog).
If the standard configuration is used, LocalStack will serve the UI through http://mailhog.localhost.localstack.cloud:4566 or http://localhost:4566/mailhog/.
It will also configure `SMTP_HOST` automatically, which points all services using SMTP, including [SES](https://docs.localstack.cloud/user-guide/aws/ses/), to MailHog.
## Install
Install the extension either via our extensions manager at https://app.localstack.cloud, or via the CLI
```bash
localstack extensions install localstack-extension-mailhog
```
After starting LocalStack, you should see these lines in the log:
```
2023-07-26T10:00:08.072 INFO --- [ MainThread] mailhog.extension : serving mailhog extension on host: http://mailhog.localhost.localstack.cloud:4566
2023-07-26T10:00:08.072 INFO --- [ MainThread] mailhog.extension : serving mailhog extension on path: http://localhost:4566/mailhog/
```
## Install from GitHub repository
Alternatively, you can install the latest unreleased version directly from the GitHub repository by running:
```bash
localstack extensions install "git+https://github.com/localstack/localstack-extensions/#egg=localstack-mailhog-extension&subdirectory=mailhog"
```
## Integration with LocalStack
When using this extension, LocalStack is automatically configured to use the MailHog SMTP server when sending emails.
For example, if you run the following SES commands:
```console
$ awslocal ses verify-email-identity --email-address user1@yourdomain.com
```
```
$ awslocal ses send-email \
--from user1@yourdomain.com \
--message 'Body={Text={Data="Hello from LocalStack to MailHog"}},Subject={Data=Test Email}' \
--destination 'ToAddresses=recipient1@example.com'
{
"MessageId": "ktrmpmhohorxfbjd-dzebwdgu-odnm-wyvz-pezg-mijejwlvaxtr-psfctr"
}
```
You should see the mail arriving in MailHog.

## Configure
You can use the [MailHog configuration environment variables](https://github.com/mailhog/MailHog/blob/master/docs/CONFIG.md) to configure the extension.
When using the CLI, you can add them by using `DOCKER_FLAGS='-e MH_<var>=<val> -e ...'`.
If you are using docker compose, simply add them as environment variables to the container.
## Development
### Install local development version
To install the extension into localstack in developer mode, you will need Python 3.10, and create a virtual environment in the extensions project.
In the newly generated project, simply run
```bash
make install
```
Then, to enable the extension for LocalStack, run
```bash
localstack extensions dev enable .
```
You can then start LocalStack with `EXTENSION_DEV_MODE=1` to load all enabled extensions:
```bash
EXTENSION_DEV_MODE=1 localstack start
```
## Known Limitations
The MailHog UI supports real-time updates through websockets, which is currently not supported through the default `:4566` port.
When you open the UI, you may see this error in the LocalStack logs, which is safe to ignore.
The UI won't update automatically though, so you need to click the refresh button.
```
2023-07-25T18:23:12.465 ERROR --- [-functhread3] hypercorn.error : Error in ASGI Framework
Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.10/site-packages/hypercorn/asyncio/task_group.py", line 23, in _handle
await app(scope, receive, send, sync_spawn, call_soon)
File "/opt/code/localstack/.venv/lib/python3.10/site-packages/hypercorn/app_wrappers.py", line 33, in __call__
await self.app(scope, receive, send)
File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/serving/asgi.py", line 67, in __call__
return await self.wsgi(scope, receive, send)
File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/http/asgi.py", line 324, in __call__
raise NotImplementedError("Unhandled protocol %s" % scope["type"])
NotImplementedError: Unhandled protocol websocket
2023-07-25T18:23:12.465 ERROR --- [-functhread3] hypercorn.error : Error in ASGI Framework
Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.10/site-packages/hypercorn/asyncio/task_group.py", line 23, in _handle
await app(scope, receive, send, sync_spawn, call_soon)
File "/opt/code/localstack/.venv/lib/python3.10/site-packages/hypercorn/app_wrappers.py", line 33, in __call__
await self.app(scope, receive, send)
File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/serving/asgi.py", line 67, in __call__
return await self.wsgi(scope, receive, send)
File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/http/asgi.py", line 324, in __call__
raise NotImplementedError("Unhandled protocol %s" % scope["type"])
```
## Licensing
* No modifications were made to MailHog, which is licensed under MIT license: https://github.com/mailhog/MailHog/blob/master/LICENSE.md
* The extension code is licensed under Apache License Version 2.0
Raw data
{
"_id": null,
"home_page": "https://github.com/localstack/localstack-extensions/tree/main/mailhog",
"name": "localstack-extension-mailhog",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "LocalStack",
"author_email": "info@localstack.cloud",
"download_url": "https://files.pythonhosted.org/packages/73/8a/97308ff78ae698c3441221e7bf2dd97c43c621039246cb28d62d79e44a71/localstack_extension_mailhog-0.2.0.tar.gz",
"platform": null,
"description": "LocalStack Mailhog Extension\n===============================\n[](https://app.localstack.cloud/extensions/remote?url=git+https://github.com/localstack/localstack-extensions/#egg=localstack-extension-mailhog&subdirectory=mailhog)\n\nWeb and API based SMTP testing directly in LocalStack using [MailHog](https://github.com/mailhog/MailHog).\n\nIf the standard configuration is used, LocalStack will serve the UI through http://mailhog.localhost.localstack.cloud:4566 or http://localhost:4566/mailhog/.\nIt will also configure `SMTP_HOST` automatically, which points all services using SMTP, including [SES](https://docs.localstack.cloud/user-guide/aws/ses/), to MailHog.\n\n## Install \n\nInstall the extension either via our extensions manager at https://app.localstack.cloud, or via the CLI\n\n```bash\nlocalstack extensions install localstack-extension-mailhog\n```\n\nAfter starting LocalStack, you should see these lines in the log:\n\n```\n2023-07-26T10:00:08.072 INFO --- [ MainThread] mailhog.extension : serving mailhog extension on host: http://mailhog.localhost.localstack.cloud:4566\n2023-07-26T10:00:08.072 INFO --- [ MainThread] mailhog.extension : serving mailhog extension on path: http://localhost:4566/mailhog/\n```\n\n## Install from GitHub repository\n\nAlternatively, you can install the latest unreleased version directly from the GitHub repository by running:\n\n```bash\nlocalstack extensions install \"git+https://github.com/localstack/localstack-extensions/#egg=localstack-mailhog-extension&subdirectory=mailhog\"\n```\n\n## Integration with LocalStack\n\nWhen using this extension, LocalStack is automatically configured to use the MailHog SMTP server when sending emails.\nFor example, if you run the following SES commands:\n\n```console\n$ awslocal ses verify-email-identity --email-address user1@yourdomain.com\n```\n```\n$ awslocal ses send-email \\ \n --from user1@yourdomain.com \\\n --message 'Body={Text={Data=\"Hello from LocalStack to MailHog\"}},Subject={Data=Test Email}' \\\n --destination 'ToAddresses=recipient1@example.com'\n{\n \"MessageId\": \"ktrmpmhohorxfbjd-dzebwdgu-odnm-wyvz-pezg-mijejwlvaxtr-psfctr\"\n}\n```\n\nYou should see the mail arriving in MailHog.\n\n\n\n## Configure\n\nYou can use the [MailHog configuration environment variables](https://github.com/mailhog/MailHog/blob/master/docs/CONFIG.md) to configure the extension.\nWhen using the CLI, you can add them by using `DOCKER_FLAGS='-e MH_<var>=<val> -e ...'`.\nIf you are using docker compose, simply add them as environment variables to the container.\n\n## Development\n\n### Install local development version\n\nTo install the extension into localstack in developer mode, you will need Python 3.10, and create a virtual environment in the extensions project.\n\nIn the newly generated project, simply run\n\n```bash\nmake install\n```\n\nThen, to enable the extension for LocalStack, run\n\n```bash\nlocalstack extensions dev enable .\n```\n\nYou can then start LocalStack with `EXTENSION_DEV_MODE=1` to load all enabled extensions:\n\n```bash\nEXTENSION_DEV_MODE=1 localstack start\n```\n\n## Known Limitations\n\nThe MailHog UI supports real-time updates through websockets, which is currently not supported through the default `:4566` port.\nWhen you open the UI, you may see this error in the LocalStack logs, which is safe to ignore.\nThe UI won't update automatically though, so you need to click the refresh button.\n```\n2023-07-25T18:23:12.465 ERROR --- [-functhread3] hypercorn.error : Error in ASGI Framework\nTraceback (most recent call last):\nFile \"/opt/code/localstack/.venv/lib/python3.10/site-packages/hypercorn/asyncio/task_group.py\", line 23, in _handle\nawait app(scope, receive, send, sync_spawn, call_soon)\nFile \"/opt/code/localstack/.venv/lib/python3.10/site-packages/hypercorn/app_wrappers.py\", line 33, in __call__\nawait self.app(scope, receive, send)\nFile \"/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/serving/asgi.py\", line 67, in __call__\nreturn await self.wsgi(scope, receive, send)\nFile \"/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/http/asgi.py\", line 324, in __call__\nraise NotImplementedError(\"Unhandled protocol %s\" % scope[\"type\"])\nNotImplementedError: Unhandled protocol websocket\n2023-07-25T18:23:12.465 ERROR --- [-functhread3] hypercorn.error : Error in ASGI Framework\nTraceback (most recent call last):\nFile \"/opt/code/localstack/.venv/lib/python3.10/site-packages/hypercorn/asyncio/task_group.py\", line 23, in _handle\nawait app(scope, receive, send, sync_spawn, call_soon)\nFile \"/opt/code/localstack/.venv/lib/python3.10/site-packages/hypercorn/app_wrappers.py\", line 33, in __call__\nawait self.app(scope, receive, send)\nFile \"/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/serving/asgi.py\", line 67, in __call__\nreturn await self.wsgi(scope, receive, send)\nFile \"/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/http/asgi.py\", line 324, in __call__\nraise NotImplementedError(\"Unhandled protocol %s\" % scope[\"type\"])\n```\n\n## Licensing\n\n* No modifications were made to MailHog, which is licensed under MIT license: https://github.com/mailhog/MailHog/blob/master/LICENSE.md\n* The extension code is licensed under Apache License Version 2.0\n",
"bugtrack_url": null,
"license": null,
"summary": "LocalStack Extension: MailHog",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/localstack/localstack-extensions/tree/main/mailhog"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "722b184e4d04412f4373577a94ddaa2e278c2fd7fcbc8ac2a83a2b4cfa30a357",
"md5": "0d6e4b7f115bde034470b5e2f5209cfc",
"sha256": "7e3445f89f10f4c623c053e206855213b7d1623a51cb2dbc6653687baabb87e0"
},
"downloads": -1,
"filename": "localstack_extension_mailhog-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0d6e4b7f115bde034470b5e2f5209cfc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7909,
"upload_time": "2024-08-29T10:16:10",
"upload_time_iso_8601": "2024-08-29T10:16:10.284498Z",
"url": "https://files.pythonhosted.org/packages/72/2b/184e4d04412f4373577a94ddaa2e278c2fd7fcbc8ac2a83a2b4cfa30a357/localstack_extension_mailhog-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "738a97308ff78ae698c3441221e7bf2dd97c43c621039246cb28d62d79e44a71",
"md5": "80cdbca84c76b525060ef4a1a058ec2e",
"sha256": "d0ee01865a788f023a88b810d7154665bbf41d1d25040b6a933ef278ee9d24c2"
},
"downloads": -1,
"filename": "localstack_extension_mailhog-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "80cdbca84c76b525060ef4a1a058ec2e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7017,
"upload_time": "2024-08-29T10:16:11",
"upload_time_iso_8601": "2024-08-29T10:16:11.480325Z",
"url": "https://files.pythonhosted.org/packages/73/8a/97308ff78ae698c3441221e7bf2dd97c43c621039246cb28d62d79e44a71/localstack_extension_mailhog-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-29 10:16:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "localstack",
"github_project": "localstack-extensions",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "localstack-extension-mailhog"
}