Skip to content

The open alternative to Salesforce, designed for AI.

Allow configuring the SMTP EHLO hostname (#24932)

Rolle Laukkarinen9729b1b86ac1
diff --git a/packages/twenty-server/src/engine/core-modules/email/email-driver.factory.ts b/packages/twenty-server/src/engine/core-modules/email/email-driver.factory.ts
index 706438fa8ff..424f012ec45 100644
--- a/packages/twenty-server/src/engine/core-modules/email/email-driver.factory.ts
+++ b/packages/twenty-server/src/engine/core-modules/email/email-driver.factory.ts
@@ -50,6 +50,7 @@ export class EmailDriverFactory extends DriverFactoryBase<EmailDriverInterface>
const user = this.twentyConfigService.get('EMAIL_SMTP_USER');
const pass = this.twentyConfigService.get('EMAIL_SMTP_PASSWORD');
const noTLS = this.twentyConfigService.get('EMAIL_SMTP_NO_TLS');
+ const name = this.twentyConfigService.get('EMAIL_SMTP_NAME');
if (!host || !port) {
throw new Error('SMTP driver requires host and port to be defined');
@@ -62,8 +63,13 @@ export class EmailDriverFactory extends DriverFactoryBase<EmailDriverInterface>
secure?: boolean;
ignoreTLS?: boolean;
requireTLS?: boolean;
+ name?: string;
} = { host, port };
+ if (name) {
+ options.name = name;
+ }
+
if (user && pass) {
options.auth = { user, pass };
}
diff --git a/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts b/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts
index aae9103f914..785a6f5bb7d 100644
--- a/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts
+++ b/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts
@@ -520,6 +520,15 @@ export class ConfigVariables {
@IsOptional()
EMAIL_SMTP_NO_TLS = false;
+ @ConfigVariablesMetadata({
+ group: ConfigVariablesGroup.EMAIL_SETTINGS,
+ description:
+ 'Hostname sent in the SMTP EHLO greeting. Defaults to the machine hostname; set a fully qualified name if the relay rejects it',
+ type: ConfigVariableType.STRING,
+ })
+ @IsOptional()
+ EMAIL_SMTP_NAME: string;
+
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.EMAIL_SETTINGS,
description: 'SMTP port for sending emails',