Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat(smtp): add SMTP_HELO_HOST to set the EHLO/HELO hostname

Dmitry Misharov4d0b568c07a9
diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.ts
index 4d1e1a67f6..af23082a90 100644
--- a/backend/src/lib/config/env.ts
+++ b/backend/src/lib/config/env.ts
@@ -202,6 +202,14 @@ const envSchema = z
SMTP_PASSWORD: zpStr(z.string().optional()),
SMTP_FROM_ADDRESS: zpStr(z.string().optional()),
SMTP_FROM_NAME: zpStr(z.string().optional().default("Infisical")),
+ SMTP_HELO_HOST: zpStr(
+ z
+ .string()
+ .optional()
+ .describe(
+ "Hostname announced in the SMTP EHLO/HELO greeting. Defaults to the OS hostname, which may not be a valid FQDN inside containers."
+ )
+ ),
SMTP_CUSTOM_CA_CERT: zpStr(
z.string().optional().describe("Base64 encoded custom CA certificate PEM(s) for the SMTP server")
),
@@ -950,6 +958,7 @@ export const formatSmtpConfig = () => {
return {
host: envCfg.SMTP_HOST,
port: envCfg.SMTP_PORT,
+ name: envCfg.SMTP_HELO_HOST,
auth:
envCfg.SMTP_USERNAME && envCfg.SMTP_PASSWORD
? { user: envCfg.SMTP_USERNAME, pass: envCfg.SMTP_PASSWORD }
diff --git a/docs/self-hosting/configuration/envars.mdx b/docs/self-hosting/configuration/envars.mdx
index 8f3af8336f..1dee797e37 100644
--- a/docs/self-hosting/configuration/envars.mdx
+++ b/docs/self-hosting/configuration/envars.mdx
@@ -355,6 +355,15 @@ Without email configuration, Infisical's core functions like sign-up/login and s
Name label to be used in From field (e.g. Team)
</ParamField>
+<ParamField query="SMTP_HELO_HOST" type="string" default="none" optional>
+ Hostname that Infisical announces in the SMTP `EHLO`/`HELO` greeting. When
+ unset, the underlying mailer falls back to the operating system hostname.
+ Inside containers (e.g. Cloud Run, Kubernetes) the OS hostname is typically a
+ random container ID, which can be rejected by SMTP relays that validate the
+ sender hostname (such as Gmail SMTP relay with sender-hostname checks). Set
+ this to a valid FQDN that the relay accepts.
+</ParamField>
+
<ParamField query="SMTP_IGNORE_TLS" type="bool" default="false" optional>
If this is `true` and `SMTP_PORT` is not 465 then TLS is not used even if the
server supports STARTTLS extension.