{"id":21971286,"url":"https://github.com/eldada/postfix-relay-kubernetes","last_synced_at":"2025-04-28T11:46:20.861Z","repository":{"id":37863760,"uuid":"152376610","full_name":"eldada/postfix-relay-kubernetes","owner":"eldada","description":"Run postfix in a Docker container and in Kubernetes with helm","archived":false,"fork":false,"pushed_at":"2023-03-13T06:54:50.000Z","size":32,"stargazers_count":37,"open_issues_count":1,"forks_count":34,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T09:21:54.667Z","etag":null,"topics":["docker","hacktoberfest","helm-chart","kubernetes","postfix","postfix-relay"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/eldada.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-10T06:52:08.000Z","updated_at":"2025-03-01T22:03:10.000Z","dependencies_parsed_at":"2022-07-14T02:10:34.045Z","dependency_job_id":null,"html_url":"https://github.com/eldada/postfix-relay-kubernetes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldada%2Fpostfix-relay-kubernetes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldada%2Fpostfix-relay-kubernetes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldada%2Fpostfix-relay-kubernetes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldada%2Fpostfix-relay-kubernetes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldada","download_url":"https://codeload.github.com/eldada/postfix-relay-kubernetes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251309144,"owners_count":21568749,"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":["docker","hacktoberfest","helm-chart","kubernetes","postfix","postfix-relay"],"created_at":"2024-11-29T14:49:52.540Z","updated_at":"2025-04-28T11:46:20.845Z","avatar_url":"https://github.com/eldada.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Postfix relay running in Kubernetes\nThis repository has an example of a postfix relay running in Kubernetes using a helm chart.\n\n## Build Docker image\nYou can build the Docker image locally\n```bash\n# For local build\ndocker build -t eldada.jfrog.io/docker/postfix-relay:0.9 Docker/\n\n# Multi arch build and push\ndocker buildx build --platform linux/amd64,linux/arm64 -t eldada.jfrog.io/docker/postfix-relay:0.9 Docker/p --push\n```\n\n## Run locally with Docker\nRun the postfix relay locally for testing\n```bash\n# Need to set SMTP connection details\nexport SMTP=\"[smtp.mailgun.org]:587\"\nexport USERNAME_TEST=\u003cyour smtp username\u003e\nexport PASSWORD_TEST=\u003cyour smtp password\u003e\n\n# Optional custom configuration to add/override in /etc/postfix/main.cf (delimited by a \";\")\nexport POSTFIX_CUSTOM_CONFIG=\"key1 = value1;key2 = value2;key3 = value3\"\n\n# Set list of allowed networks\nexport TX_SMTP_RELAY_NETWORKS='10.0.0.0/8,127.0.0.0/8,172.17.0.0/16,192.0.0.0/8'\n\ndocker run --rm -d --name postfix-relay -p 2525:25 \\\n\t-e TX_SMTP_RELAY_HOST=\"${SMTP}\" \\\n\t-e TX_SMTP_RELAY_MYHOSTNAME=my.local \\\n\t-e TX_SMTP_RELAY_USERNAME=${USERNAME_TEST} \\\n\t-e TX_SMTP_RELAY_PASSWORD=${PASSWORD_TEST} \\\n\t-e TX_SMTP_RELAY_NETWORKS=${TX_SMTP_RELAY_NETWORKS} \\\n\t-e POSTFIX_CUSTOM_CONFIG=\"${POSTFIX_CUSTOM_CONFIG}\" \\\n\teldada.jfrog.io/docker/postfix-relay:0.9\n```\n\n### Test sending mail\n1. Connect to running container on port 2525\n```bash\ntelnet localhost 2525\n```\n\n2. Edit the following with your details and paste in your terminal\n```bash\nhelo localhost\nmail from: noreply@yourhost.com\nrcpt to: you@your.co\ndata\nSubject: Subject here...\nThe true story of swans singing Pink Floyd. \n.\nquit\n```\n\n3. You should see the following\n```bash\n220 tx-smtp-relay.yourhost.com ESMTP Postfix\nhelo localhost\n250 tx-smtp-relay.yourhost.com\nmail from: noreply@yourhost.com\n250 2.1.0 Ok\nrcpt to: you@your.co\n250 2.1.5 Ok\ndata\n354 End data with \u003cCR\u003e\u003cLF\u003e.\u003cCR\u003e\u003cLF\u003e\nSubject: Subject here...\nThe true story of swans singing Pink Floyd. \n.\n250 2.0.0 Ok: queued as 982FF53C\nquit\n221 2.0.0 Bye\nConnection closed by foreign host\n```\n\n4. Check the inbox of `you@your.co` and see you got the email.\n\n\n## Deploy Helm Chart\nThe Helm Chart in [helm/postfix](helm/postfix) directory can be used to deploy the postfix-relay into your Kubernetes cluster.\n\nCreate a `custom-values.yaml` with the configuration details\n```yaml\nsmtp:\n  relayHost: \"[smtp.mailgun.org]:587\"\n  relayMyhostname: \u003cyour smtp hostname\u003e\n  relayUsername: \u003cyour smtp username\u003e\n  relayPassword: \u003cyour smtp password\u003e\n  relayNetworks: '10.0.0.0/8,127.0.0.0/8,172.17.0.0/16,192.0.0.0/8'\n```\n\nDeploy postfix\n```bash\nhelm upgrade --install postfix-relay helm/postfix -f custom-values.yaml\n```\n\n### Postfix Metrics exporter\nAn optional postfix-exporter sidecar can be deployed for exposing postfix metrics. This is using the work from https://github.com/kumina/postfix_exporter.\n\nTo enable the exporter sidecar, update your `custom-values.yaml` file and **add**\n```yaml\n# Enable the postfix-exporter sidecar\nexporter:\n  enabled: true\n\n# Enable a ServiceMonitor object for Prometheus scraping\nserviceMonitor:\n  enabled: true\n```\n\nDeploy postfix\n```bash\nhelm upgrade --install postfix-relay helm/postfix -f custom-values.yaml\n```\n\n## Thanks\nThe work in this repository is based on\n- https://github.com/applariat/kubernetes-postfix-relay-host\n- https://github.com/kumina/postfix_exporter\n- My pains\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldada%2Fpostfix-relay-kubernetes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldada%2Fpostfix-relay-kubernetes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldada%2Fpostfix-relay-kubernetes/lists"}