Title: Self-hosted on Kubernetes: SMTP mailer sends EHLO [127.0.0.1], rejected by strict SMTP relays (all outbound email fails) · Issue #6778 · simstudioai/sim · GitHub
Open Graph Title: Self-hosted on Kubernetes: SMTP mailer sends EHLO [127.0.0.1], rejected by strict SMTP relays (all outbound email fails) · Issue #6778 · simstudioai/sim
X Title: Self-hosted on Kubernetes: SMTP mailer sends EHLO [127.0.0.1], rejected by strict SMTP relays (all outbound email fails) · Issue #6778 · simstudioai/sim
Description: Summary On self-hosted Kubernetes deployments, the SMTP email provider sends EHLO [127.0.0.1] on every connection. Strict SMTP servers — notably Google Workspace's SMTP relay (smtp-relay.gmail.com) — reject this with a 421 tarpit, so eve...
Open Graph Description: Summary On self-hosted Kubernetes deployments, the SMTP email provider sends EHLO [127.0.0.1] on every connection. Strict SMTP servers — notably Google Workspace's SMTP relay (smtp-relay.gmail.com)...
X Description: Summary On self-hosted Kubernetes deployments, the SMTP email provider sends EHLO [127.0.0.1] on every connection. Strict SMTP servers — notably Google Workspace's SMTP relay (smtp-relay.gmail....
Opengraph URL: https://github.com/simstudioai/sim/issues/6778
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Self-hosted on Kubernetes: SMTP mailer sends EHLO [127.0.0.1], rejected by strict SMTP relays (all outbound email fails)","articleBody":"### Summary\n\nOn self-hosted Kubernetes deployments, the SMTP email provider sends `EHLO [127.0.0.1]` on every connection. Strict SMTP servers — notably Google Workspace's SMTP relay (`smtp-relay.gmail.com`) — reject this with a `421` tarpit, so **every outbound email fails** (invitations, verification, etc.) even when the relay is configured correctly.\n\n### Root cause\n\n`apps/sim/lib/messaging/email/providers/smtp.ts` creates the nodemailer transport without a `name` option:\n\n```ts\nconst transporter = nodemailer.createTransport({\n host: env.SMTP_HOST,\n port,\n secure,\n auth: ...,\n})\n```\n\nWhen `name` is not provided, nodemailer's `SMTPConnection._getHostname()` falls back to `os.hostname()` — **and if that hostname contains no dot, it replaces it with `[127.0.0.1]`**:\n\n```js\n_getHostname() {\n let hostname;\n try { hostname = os.hostname() || ''; } catch (err) { hostname = 'localhost'; }\n if (!hostname || hostname.indexOf('.') \u003c 0) {\n hostname = '[127.0.0.1]'; // \u003c-- always taken on Kubernetes\n }\n ...\n}\n```\n\nKubernetes pod hostnames (e.g. `sim-app-5b8f7d9c4-x2k9q`) never contain a dot, so on k8s this fallback is taken 100% of the time and the mailer introduces itself as loopback.\n\n### Symptom\n\nAgainst Google Workspace SMTP relay, every send fails at the EHLO stage:\n\n```\nError: Server terminates connection. response=421-4.7.0 Try again later, closing connection. (EHLO)\n421-4.7.0 For more information, go to\n421 4.7.0 https://support.google.com/a/answer/3221692 ... - gsmtp\n```\n\nsurfaced in the UI as `All email providers failed: ...` (e.g. when inviting workspace members). Note: Sim still creates the invitation DB row before the email attempt, so the UI can show a member as invited even though no email was ever delivered.\n\nThis is easy to misdiagnose as a relay/allowlist misconfiguration — the relay setup was correct in our case, and raw SMTP sessions from the same pod / same egress IP succeeded whenever a dotted EHLO name was used.\n\n### Reproduction\n\nFrom any Kubernetes pod, open an SMTP session to `smtp-relay.gmail.com:587`:\n\n- `EHLO [127.0.0.1]` → `421-4.7.0 Try again later, closing connection. (EHLO)`\n- `EHLO any.dotted.name` → `250` (and the full send succeeds)\n\nVerified on v0.7.50; `smtp.ts` on current `main` still passes no `name`, so the bug should still be present.\n\n### Suggested fix\n\nPlumb an optional env var through to the transport, e.g.:\n\n```ts\nname: env.SMTP_EHLO_NAME || undefined,\n```\n\n(plus the env schema entry / helm chart docs). Defaulting to the current behavior keeps it non-breaking; a fancier default could use `os.hostname()` only when it's a FQDN and otherwise fall back to the configured public app domain.\n\n### Workaround for other k8s users\n\nForce the pod's kernel hostname to be a FQDN so nodemailer uses it:\n\n```bash\nkubectl -n \u003cns> patch deploy \u003capp-deploy> --type=strategic \\\n -p '{\"spec\":{\"template\":{\"spec\":{\"hostname\":\"sim-app\",\"subdomain\":\"sim-app\",\"setHostnameAsFQDN\":true}}}}'\n```\n\nAfter the rollout, `os.hostname()` returns `sim-app.sim-app.\u003cns>.svc.cluster.local` (contains dots), nodemailer sends it as the EHLO name, and Google's relay accepts it. Confirmed working.\n\n### Environment\n\n- Sim v0.7.50 (helm chart 1.4.0), self-hosted on GKE\n- Email provider: SMTP (`smtp-relay.gmail.com:587`, STARTTLS, IP-allowlist relay)\n","author":{"url":"https://github.com/MatteoCarrabba","@type":"Person","name":"MatteoCarrabba"},"datePublished":"2026-08-17T18:28:18Z","url":"https://github.com/simstudioai/sim/issues/6778"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5cfb32a7-300e-a4ad-433a-cecf48f7e83f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BCE6:2D6147:AD3A08:F5B74C:6AFB5982 |
| html-safe-nonce | b9ab1020a51be34280e64e8a40fbfda6d3411c93d4a7b31bc09478f0c0a06ea5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQ0U2OjJENjE0NzpBRDNBMDg6RjVCNzRDOjZBRkI1OTgyIiwidmlzaXRvcl9pZCI6IjU3NDUzMDU5NzE4NjU2MzkyOTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cec922623dfe920d144ad69fa7df565fb6a1532832676e42b8b0192e958eda45 |
| hovercard-subject-tag | issue:5174202630 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/simstudioai/sim/6778/issue_layout |
| twitter:image | https://opengraph.githubassets.com/70860daff6a62892a917faaaec8a756fef9bffb268279db654bc5255c8fb4c0f/simstudioai/sim/issues/6778 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/70860daff6a62892a917faaaec8a756fef9bffb268279db654bc5255c8fb4c0f/simstudioai/sim/issues/6778 |
| og:image:alt | Summary On self-hosted Kubernetes deployments, the SMTP email provider sends EHLO [127.0.0.1] on every connection. Strict SMTP servers — notably Google Workspace's SMTP relay (smtp-relay.gmail.com)... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MatteoCarrabba |
| hostname | github.com |
| expected-hostname | github.com |
| None | ea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94 |
| turbo-cache-control | no-preview |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ef97164c52cf59bd10558ddec9c4f482763988 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width