From cf07cfe3abadac0bcdbb136896e6f2cfe71fd142 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Thu, 1 Sep 2022 07:40:35 +0200 Subject: [PATCH] :technologist: (smtp) Use secure prop instead of ignoreTLS BREAKING CHANGE: The SMTP_IGNORE_TLS environment has been removed in favore of SMTP_SECURE. If SMTP_SECURE is true, the connection will use TLS when connecting to server. If false (the default) then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false --- apps/builder/pages/api/auth/[...nextauth].ts | 4 +++- .../self-hosting/configuration/builder.mdx | 18 +++++++++--------- .../docs/self-hosting/configuration/viewer.mdx | 16 ++++++++-------- .../typebots/[typebotId]/integrations/email.ts | 2 +- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/apps/builder/pages/api/auth/[...nextauth].ts b/apps/builder/pages/api/auth/[...nextauth].ts index f06e5edb267..0ef1add7be9 100644 --- a/apps/builder/pages/api/auth/[...nextauth].ts +++ b/apps/builder/pages/api/auth/[...nextauth].ts @@ -32,11 +32,13 @@ if (isNotEmpty(env('SMTP_FROM')) && process.env.SMTP_AUTH_DISABLED !== 'true') server: { host: process.env.SMTP_HOST, port: process.env.SMTP_PORT ? Number(process.env.SMTP_PORT) : 25, + secure: process.env.SMTP_SECURE + ? process.env.SMTP_SECURE === 'true' + : false, auth: { user: process.env.SMTP_USERNAME, pass: process.env.SMTP_PASSWORD, }, - ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true', }, from: env('SMTP_FROM'), }) diff --git a/apps/docs/docs/self-hosting/configuration/builder.mdx b/apps/docs/docs/self-hosting/configuration/builder.mdx index 1136d82fb56..594406eb9bf 100644 --- a/apps/docs/docs/self-hosting/configuration/builder.mdx +++ b/apps/docs/docs/self-hosting/configuration/builder.mdx @@ -22,15 +22,15 @@ import { SponsorButton } from '../../../src/js/SponsorButton.jsx' Used for sending email notifications and authentication -| Parameter | Default | Description | -| --------------------- | ------- | ------------------------------------------------------------------------------------------ | -| SMTP_USERNAME | -- | SMTP username | -| SMTP_PASSWORD | -- | SMTP password | -| SMTP_HOST | -- | SMTP host. (i.e. `smtp.host.com`) | -| SMTP_PORT | 25 | SMTP port | -| NEXT_PUBLIC_SMTP_FROM | - | From name and email (i.e. `'Typebot Notifications' `) | -| SMTP_AUTH_DISABLED | false | To disable the authentication by email but still use the provided config for notifications | -| SMTP_IGNORE_TLS | false | Don't use TLS even if the server supports STARTTLS extension | +| Parameter | Default | Description | +| --------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| SMTP_USERNAME | -- | SMTP username | +| SMTP_PASSWORD | -- | SMTP password | +| SMTP_HOST | -- | SMTP host. (i.e. `smtp.host.com`) | +| SMTP_PORT | 25 | SMTP port | +| NEXT_PUBLIC_SMTP_FROM | - | From name and email (i.e. `'Typebot Notifications' `) | +| SMTP_SECURE | false | If true the connection will use TLS when connecting to server. If false (the default) then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false | +| SMTP_AUTH_DISABLED | false | To disable the authentication by email but still use the provided config for notifications | ## Google (Auth, Sheets, Fonts) diff --git a/apps/docs/docs/self-hosting/configuration/viewer.mdx b/apps/docs/docs/self-hosting/configuration/viewer.mdx index 2e126a5d219..cd2db86542b 100644 --- a/apps/docs/docs/self-hosting/configuration/viewer.mdx +++ b/apps/docs/docs/self-hosting/configuration/viewer.mdx @@ -19,14 +19,14 @@ import { SponsorButton } from '../../../src/js/SponsorButton.jsx' Used for sending email notifications and authentication -| Parameter | Default | Description | -| --------------- | ------- | ------------------------------------------------------------------------------- | -| SMTP_USERNAME | -- | SMTP username | -| SMTP_PASSWORD | -- | SMTP password | -| SMTP_HOST | -- | SMTP host. (i.e. `smtp.host.com`) | -| SMTP_PORT | 25 | SMTP port | -| SMTP_FROM | - | From name and email (i.e. `'Typebot Notifications' `) | -| SMTP_IGNORE_TLS | false | Don't use TLS even if the server supports STARTTLS extension | +| Parameter | Default | Description | +| ------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| SMTP_USERNAME | -- | SMTP username | +| SMTP_PASSWORD | -- | SMTP password | +| SMTP_HOST | -- | SMTP host. (i.e. `smtp.host.com`) | +| SMTP_PORT | 25 | SMTP port | +| SMTP_FROM | - | From name and email (i.e. `'Typebot Notifications' `) | +| SMTP_SECURE | false | If true the connection will use TLS when connecting to server. If false (the default) then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false | ## Google (Sheets) diff --git a/apps/viewer/pages/api/typebots/[typebotId]/integrations/email.ts b/apps/viewer/pages/api/typebots/[typebotId]/integrations/email.ts index ab29c379236..c4c2c88e504 100644 --- a/apps/viewer/pages/api/typebots/[typebotId]/integrations/email.ts +++ b/apps/viewer/pages/api/typebots/[typebotId]/integrations/email.ts @@ -32,11 +32,11 @@ const cors = initMiddleware(Cors()) const defaultTransportOptions = { host: process.env.SMTP_HOST, port: Number(process.env.SMTP_PORT), + secure: process.env.SMTP_SECURE ? process.env.SMTP_SECURE === 'true' : false, auth: { user: process.env.SMTP_USERNAME, pass: process.env.SMTP_PASSWORD, }, - ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true', } const defaultFrom = {