Skip to content

Commit

Permalink
Add support for self-signed SMTP servers (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinejaussoin authored Apr 23, 2022
1 parent 04867a0 commit 065a192
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ MAIL_SECURE=true
MAIL_USER=
MAIL_PASSWORD=
MAIL_SENDER=[email protected]
MAIL_ALLOW_SELF_SIGNED_CERTS=false
STRIPE_SECRET=
STRIPE_KEY=
STRIPE_WEBHOOK_SECRET=
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ This will run a demo version, which you can turn into a fully licenced version b

### Version 4.15.0 (not released)

- Improve Admin dashboard for Self-Hosted, allowing the admin to add and delete users
- **Self-Hosting**: Improve Admin dashboard for Self-Hosted, allowing the admin to add and delete users
- Fix GDPR account deletion, which did not work when the user had written messages (chat)
- Upgrade React typings to v18
- Upgrade all frontend dependencies
- **Self-Hosting**: Add an option to allow self-signed certificates for the SMTP server, for sending emails

### Version 4.14.1 (hotfix)

Expand All @@ -100,9 +101,9 @@ This will run a demo version, which you can turn into a fully licenced version b

- Upgrade to React 18
- Replace icons by emoji for columns headers (fully customisable)
- Adding SMTP support for self-hosting, in addition to SendGrid. 👏 Thanks [@dayByte](https://github.com/dayByte) for the idea. ([#365](https://github.com/antoinejaussoin/retro-board/issues/365)).
- Simplification of SendGrid setup, by removing the need of creating email templates. They are now hardcoded.
- Improving email templates
- **Self-Hosting**: Adding SMTP support for self-hosting, in addition to SendGrid. 👏 Thanks [@dayByte](https://github.com/dayByte) for the idea. ([#365](https://github.com/antoinejaussoin/retro-board/issues/365)).
- **Self-Hosting**: Simplification of SendGrid setup, by removing the need of creating email templates. They are now hardcoded.
- **Self-Hosting**: Improving email templates
- Improving Text and Markdown exports on Summary Mode. 👏 Thanks Jakob J for the idea. ([#384](https://github.com/antoinejaussoin/retro-board/issues/384)).

### Version 4.13.0
Expand All @@ -111,7 +112,7 @@ This will run a demo version, which you can turn into a fully licenced version b
- Update prices, especially for USD
- Make the integration tests less brittle by using specific attributes
- Upgrade (finally!) to React-Router v6.
- Self-Hosting: Allow an administrator to disable Anonymous Logins (to force users to use regular accounts).
- **Self-Hosting**: Allow an administrator to disable Anonymous Logins (to force users to use regular accounts).

### Version 4.12.1 (hotfix)

Expand Down
4 changes: 4 additions & 0 deletions backend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ const config: BackendConfig = {
MAIL_SENDER: defaults('MAIL_SENDER', ''),
MAIL_USER: defaults('MAIL_USER', ''),
MAIL_PASSWORD: defaults('MAIL_PASSWORD', ''),
MAIL_ALLOW_SELF_SIGNED_CERTS: defaultsBool(
'MAIL_ALLOW_SELF_SIGNED_CERTS',
false
),
};

export default config;
5 changes: 5 additions & 0 deletions backend/src/email/smtp-sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ const transporter = nodemailer.createTransport({
host: config.MAIL_SMTP_HOST,
port: config.MAIL_PORT,
secure: config.MAIL_SECURE,
tls: config.MAIL_ALLOW_SELF_SIGNED_CERTS
? {
rejectUnauthorized: false,
}
: undefined,
auth: {
user: config.MAIL_USER,
pass: config.MAIL_PASSWORD,
Expand Down
1 change: 1 addition & 0 deletions backend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export interface BackendConfig {
MAIL_USER: string;
MAIL_PASSWORD: string;
MAIL_SENDER: string;
MAIL_ALLOW_SELF_SIGNED_CERTS: boolean;
}

export type LicenceMetadata = {
Expand Down
1 change: 1 addition & 0 deletions docs/docs/self-hosting/optionals.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ services:
MAIL_USER: # SMTP username (or email)
MAIL_PASSWORD: # SMTP user password
MAIL_SENDER: # SMTP sender email (usually matches MAIL_USER)
MAIL_ALLOW_SELF_SIGNED_CERTS: 'false' # Only set to true if you want to (unsafely) allow an SMTP server with self-signed certificates
STRIPE_SECRET: # Stripe payment account secret
STRIPE_WEBHOOK_SECRET: # Stripe webhook secret
STRIPE_TEAM_PRODUCT: # Stripe product information
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/self-hosting/sendgrid.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ In the `backend` section of your `docker-compose.yml` file, add the following va
- `MAIL_USER`: SMTP username (or email)
- `MAIL_PASSWORD`: SMTP user password
- `MAIL_SENDER`: SMTP sender email (usually matches `MAIL_USER`)

- `MAIL_ALLOW_SELF_SIGNED_CERTS`: Only set to true if you want to (unsafely) allow an SMTP server with self-signed certificates
1 change: 1 addition & 0 deletions self-hosting/docker-compose.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ services:
MAIL_USER: # SMTP username (or email)
MAIL_PASSWORD: # SMTP user password
MAIL_SENDER: # SMTP sender email (usually matches MAIL_USER)
MAIL_ALLOW_SELF_SIGNED_CERTS: 'false' # Only set to true if you want to (unsafely) allow an SMTP server with self-signed certificates
STRIPE_SECRET: # Stripe payment account secret
STRIPE_WEBHOOK_SECRET: # Stripe webhook secret
STRIPE_TEAM_PRODUCT: # Stripe product information
Expand Down

0 comments on commit 065a192

Please sign in to comment.