fix: separate SMTP envelope and header addresses (#21840)

## Description

When configuring a From address with a display name (e.g., `Coder System
<system@coder.com>`), the SMTP `MAIL FROM` command was incorrectly
receiving the full address string instead of just the bare email
address, causing `501 Invalid MAIL argument` errors on some SMTP
servers.

## Changes

- Updated `validateFromAddr` to return both:
  - `envelopeFrom`: bare email for SMTP `MAIL FROM` command (RFC 5321)
- `headerFrom`: original address with display name for email header (RFC
5322)

Fixes #20727
This commit is contained in:
Marcin Tojek
2026-02-02 13:53:02 +01:00
committed by GitHub
parent ea1e8c083b
commit 3e369c0b04
4 changed files with 224 additions and 12 deletions
+5 -5
View File
@@ -109,11 +109,11 @@ existing one.
**Server Settings:**
| Required | CLI | Env | Type | Description | Default |
|:--------:|---------------------|-------------------------|----------|-----------------------------------------------------------|-----------|
| ✔️ | `--email-from` | `CODER_EMAIL_FROM` | `string` | The sender's address to use. | |
| ✔️ | `--email-smarthost` | `CODER_EMAIL_SMARTHOST` | `string` | The SMTP relay to send messages (format: `hostname:port`) | |
| ✔️ | `--email-hello` | `CODER_EMAIL_HELLO` | `string` | The hostname identifying the SMTP server. | localhost |
| Required | CLI | Env | Type | Description | Default |
|:--------:|---------------------|-------------------------|----------|-------------------------------------------------------------------|-----------|
| ✔️ | `--email-from` | `CODER_EMAIL_FROM` | `string` | The sender's address to use (e.g. `"Coder <coder@example.com>"`). | |
| ✔️ | `--email-smarthost` | `CODER_EMAIL_SMARTHOST` | `string` | The SMTP relay to send messages (format: `hostname:port`) | |
| ✔️ | `--email-hello` | `CODER_EMAIL_HELLO` | `string` | The hostname identifying the SMTP server. | localhost |
**Authentication Settings:**