{"id":25810267,"url":"https://github.com/jurajmajer/email-microservice","last_synced_at":"2026-04-09T17:37:13.579Z","repository":{"id":241746619,"uuid":"807557000","full_name":"jurajmajer/email-microservice","owner":"jurajmajer","description":"Microservice written in Python for sending emails based on jinja templates","archived":false,"fork":false,"pushed_at":"2025-03-10T13:53:45.000Z","size":75,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T14:39:27.974Z","etag":null,"topics":["docker","email-sender","fastapi","jinja2","kubernetes","microservice","python3","smtp"],"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/jurajmajer.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":"2024-05-29T10:27:47.000Z","updated_at":"2025-03-10T13:53:48.000Z","dependencies_parsed_at":"2025-03-10T14:42:45.320Z","dependency_job_id":null,"html_url":"https://github.com/jurajmajer/email-microservice","commit_stats":null,"previous_names":["jurajmajer/email-microservice"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jurajmajer/email-microservice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurajmajer%2Femail-microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurajmajer%2Femail-microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurajmajer%2Femail-microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurajmajer%2Femail-microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jurajmajer","download_url":"https://codeload.github.com/jurajmajer/email-microservice/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurajmajer%2Femail-microservice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000701,"owners_count":26082805,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["docker","email-sender","fastapi","jinja2","kubernetes","microservice","python3","smtp"],"created_at":"2025-02-27T23:37:36.593Z","updated_at":"2025-10-08T19:21:47.458Z","avatar_url":"https://github.com/jurajmajer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Email Microservice\n[![Build Docker Image](https://github.com/jurajmajer/email-microservice/actions/workflows/build-docker-image.yml/badge.svg)](https://github.com/jurajmajer/email-microservice/actions/workflows/build-docker-image.yml)\n![pylint Score](https://mperlet.github.io/pybadge/badges/9.74.svg)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/jurajmajer/email-microservice/blob/main/LICENSE)\n\n## Installation on Kubernetes\n1. Create database on your DB server. We use MySQL.\n```sql\nCREATE DATABASE IF NOT EXISTS `email-microservice` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\nCREATE USER 'email-microservice'@'%' IDENTIFIED BY '\u003cinsert_password_here\u003e';\nGRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, LOCK TABLES ON `email-microservice`.* TO 'email-microservice'@'%';\n```\n2. Create schema in the database ideally using Alembic migration. If it is not possible, you can use sql script `script/initdb.sql`\n3. Review deployment scripts for Kubernetes in folder `infra/k8s`. At minimum you have to modify `1-init.yaml` and set secret values (replace `\u003cdefine-this\u003e` with actual value).\n4. Apply kubernetes scripts:\n```\nkubectl apply -f infra/k8s/1-init.yaml\nkubectl apply -f infra/k8s/2-define-storage.yaml\nkubectl apply -f infra/k8s/3-deployment.yaml\n```\n5. Save your email templates to TEMPLATE_ROOT. See details about TEMPLATE_ROOT structure below.\n\n### Environment variables which need to be set in runtime\n* `TEMPLATE_ROOT` - folder where all templates are stored. No default value, must be set.\n* `EMAIL_CONTENT_ROOT` - folder where email-microservice will store output of jinja template transformation. It is the email message body. No default value, must be set.\n* `ATTACHMENT_ROOT` - folder where email attachments are stored. No default value, must be set when using attachments.\n* `SENDER_ADDRESS` - FROM address of emails. No default value, must be set.\n* `SENDER_NAME` - FROM name of emails. No default value, optional.\n* `SMTP_USERNAME` - username for login to SMTP server. No default value, must be set.\n* `SMTP_PASSWORD` - password for login to SMTP server. No default value, must be set.\n* `SMTP_SERVER` - URL of SMTP server. No default value, must be set.\n* `SMTP_PORT` - SMTP port. Default value: 465\n* `DB_URI` - Database connection string. No default value, must be set. E.g.: mysql://email-microservice:\u003cpassword\u003e@\u003cdb-server\u003e/email-microservice\n\n### TEMPLATE_ROOT structure\nemail-microservice assumes following structure of TEMPLATE_ROOT folder:\n\n```\nTEMPLATE_ROOT\n│\n└───en\n│   │\n│   └───\u003ctemplateId1\u003e\n│   │      html.jinja2\n│   │      plain.jinja2\n│   │  \n│   └───\u003ctemplateId2\u003e\n|          html.jinja2\n|          plain.jinja2\n│\n└───de\n│   │\n│   └───\u003ctemplateId1\u003e\n│   │      html.jinja2\n│   │  \n│   └───\u003ctemplateId2\u003e\n|          html.jinja2\n```\nUnder TEMPLATE_ROOT there is a set of folders named by languages (`en`, `de` etc.). In every language folder there are folders named by template IDs. In every template ID folder there can be one file for html email content named exactly `html.jinja2` and one file for plain text email content named exactly `plain.jinja2`. It is not required to have both `plain.jinja2` and `html.jinja2`. If e.g. `plain.jinja2` is omitted, it will simply not be included in the email.\n\n## Usage\nOther pods should use OpenAPI interface of email-microservice for sending emails. OpenAPI interface does not require any authentication. It is assumed email-microservice is accessible only within the cluster. Swagger documentation is available after installation under [http://\\\u003cemail-microservice\\\u003e/docs](http://email-microservice/docs). Alternatively, you can check out the swagger UI [here](https://jurajmajer.github.io/email-microservice/openapi/).\n\n## Spam Troubleshooting\nThis project (email-microservice) has no effect on whether sent email ends up in the spam folder or not. You need to troubleshoot your SMTP server settings to avoid spam folder. Here are some tips what you can do:\n* Test your emails on [mail-tester.com](https://www.mail-tester.com/)\n* Check if Sender Policy Framework (SPF) email authentication is enabled for your domain\n* Check if DomainKeys Identified Mail (DKIM) email authentication is enabled for your domain\n* Check if Domain-based Message Authentication, Reporting and Conformance (DMARC) email authentication is enabled for your domain\n\n## Contribution / Development\n### Generate requirements.txt (Powershell)\nNavigate in Powershell to the root folder of project, e.g. `C:\\projects\\email-microservice` and execute:\n```Powershell\n.\\script\\create-pip-requirements.ps1\n```\n\n### Generate and apply Alembic migration (Powershell)\nNavigate in Powershell to `db` folder of project, e.g. `C:\\projects\\email-microservice\\app\\db` and execute:\n```Powershell\n$env:PYTHONPATH = 'C:/projects/email-microservice/'\n$env:DB_URI = 'mysql://email-microservice:\u003cpassword\u003e@localhost/email-microservice'\nalembic revision --autogenerate -m \"\u003ccustom message\u003e\"\nalembic upgrade head\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjurajmajer%2Femail-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjurajmajer%2Femail-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjurajmajer%2Femail-microservice/lists"}