-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Rework mailer settings #18982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Rework mailer settings #18982
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
d60c438
Rework mailer settings (fixes #18901)
clarfonthey bc7b454
Do proper check if SMTP_ADDR is local IP
clarfonthey a4736f8
Reword insecure SMTP warning
clarfonthey 7e0a30c
Merge branch 'main' into mailer-settings
wxiaoguang 294ddd6
Merge branch 'main' into mailer-settings
wxiaoguang 5f1d299
fix comments to "be removed in v1.19.0"
wxiaoguang dad722e
only use deprecated key if the new key doesn't exist
wxiaoguang ae30251
sync document and options
wxiaoguang 8d20702
fix smtp fields in installation page
wxiaoguang 360e32e
fix markdown lint
wxiaoguang 12c00fd
fix i18n
wxiaoguang 4ecb4e8
Update docs/content/doc/advanced/config-cheat-sheet.en-us.md
wxiaoguang 466d6ba
Update custom/conf/app.example.ini
wxiaoguang 4fbdc26
Update config-cheat-sheet.en-us.md
clarfonthey 45df0a6
Update app.example.ini
clarfonthey be36a99
Update docs to make conversion between settings clearer
clarfonthey c14ec6c
fix lint errors
wxiaoguang 60cf9a8
Merge branch 'main' into mailer-settings
wxiaoguang 8e0d486
Merge branch 'main' into mailer-settings
lunny 0556044
Merge branch 'main' into mailer-settings
lunny 48d7743
Merge branch 'main' into mailer-settings
wxiaoguang 06792df
Merge branch 'main' into mailer-settings
lunny 8e3f70b
Merge branch 'main' into mailer-settings
wxiaoguang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1503,50 +1503,58 @@ ROUTER = console | |
;; Prefix displayed before subject in mail | ||
;SUBJECT_PREFIX = | ||
;; | ||
;; Mail server | ||
;; Gmail: smtp.gmail.com:587 | ||
;; QQ: smtp.qq.com:465 | ||
;; As per RFC 8314 using Implicit TLS/SMTPS on port 465 (if supported) is recommended, | ||
;; otherwise STARTTLS on port 587 should be used. | ||
;HOST = | ||
;; | ||
;; Disable HELO operation when hostnames are different. | ||
;DISABLE_HELO = | ||
;; | ||
;; Custom hostname for HELO operation, if no value is provided, one is retrieved from system. | ||
;; Mail server protocol. One of "smtp", "smtps", "smtp+startls", "smtp+unix", "sendmail", "dummy". | ||
;; - sendmail: use the operating system's `sendmail` command instead of SMTP. This is common on Linux systems. | ||
;; - dummy: send email messages to the log as a testing phase. | ||
;; If your provider does not explicitly say which protocol it uses but does provide a port, | ||
;; you can set SMTP_PORT instead and this will be inferred. | ||
;; (Before 1.18, this was controlled via MAILER_TYPE and IS_TLS_ENABLED.) | ||
;PROTOCOL = | ||
wxiaoguang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
;; | ||
;; Mail server address, e.g. smtp.gmail.com. | ||
;; For smtp+unix, this should be a path to a unix socket instead. | ||
;; (Before 1.18, this was combined with SMTP_PORT as HOST.) | ||
;SMTP_ADDR = | ||
;; | ||
;; Mail server port. Common ports are: | ||
;; 25: insecure SMTP | ||
;; 465: SMTP Secure | ||
;; 587: StartTLS | ||
;; If no protocol is specified, it will be inferred by this setting. | ||
;; (Before 1.18, this was combined with SMTP_ADDR as HOST.) | ||
;SMTP_PORT = | ||
;; | ||
;; Enable HELO operation. Defaults to true. | ||
;ENABLE_HELO = true | ||
;; | ||
;; Custom hostname for HELO operation. | ||
;; If no value is provided, one is retrieved from system. | ||
;HELO_HOSTNAME = | ||
;; | ||
;; Whether or not to skip verification of certificates; `true` to disable verification. This option is unsafe. Consider adding the certificate to the system trust store instead. | ||
;SKIP_VERIFY = false | ||
;; If set to `true`, completely ignores server certificate validation errors. | ||
;; This option is unsafe. Consider adding the certificate to the system trust store instead. | ||
;FORCE_TRUST_SERVER_CERT = false | ||
;; | ||
;; Use client certificate | ||
;USE_CERTIFICATE = false | ||
;CERT_FILE = custom/mailer/cert.pem | ||
;KEY_FILE = custom/mailer/key.pem | ||
;; | ||
;; Should SMTP connect with TLS, (if port ends with 465 TLS will always be used.) | ||
;; If this is false but STARTTLS is supported the connection will be upgraded to TLS opportunistically. | ||
;IS_TLS_ENABLED = false | ||
;; Use client certificate in connection. | ||
;USE_CLIENT_CERT = false | ||
;CLIENT_CERT_FILE = custom/mailer/cert.pem | ||
;CLIENT_KEY_FILE = custom/mailer/key.pem | ||
;; | ||
;; Mail from address, RFC 5322. This can be just an email address, or the `"Name" <[email protected]>` format | ||
;FROM = | ||
;; | ||
;; Sometimes it is helpful to use a different address on the envelope. Set this to use ENVELOPE_FROM as the from on the envelope. Set to `<>` to send an empty address. | ||
;ENVELOPE_FROM = | ||
;; | ||
;; Mailer user name and password | ||
;; Please Note: Authentication is only supported when the SMTP server communication is encrypted with TLS (this can be via STARTTLS) or `HOST=localhost`. | ||
;; Mailer user name and password, if required by provider. | ||
;USER = | ||
;; | ||
;; Use PASSWD = `your password` for quoting if you use special characters in the password. | ||
;PASSWD = | ||
;; | ||
;; Send mails as plain text | ||
;; Send mails only in plain text, without HTML alternative | ||
;SEND_AS_PLAIN_TEXT = false | ||
;; | ||
;; Set Mailer Type (either SMTP, sendmail or dummy to just send to the log) | ||
;MAILER_TYPE = smtp | ||
;; | ||
;; Specify an alternative sendmail binary | ||
;SENDMAIL_PATH = sendmail | ||
;; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -647,41 +647,35 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type | |
## Mailer (`mailer`) | ||
|
||
- `ENABLED`: **false**: Enable to use a mail service. | ||
- `DISABLE_HELO`: **\<empty\>**: Disable HELO operation. | ||
- `HELO_HOSTNAME`: **\<empty\>**: Custom hostname for HELO operation. | ||
- `HOST`: **\<empty\>**: SMTP mail host address and port (example: smtp.gitea.io:587). | ||
- As per RFC 8314, if supported, Implicit TLS/SMTPS on port 465 is recommended, otherwise opportunistic TLS via STARTTLS on port 587 should be used. | ||
- `IS_TLS_ENABLED` : **false** : Forcibly use TLS to connect even if not on a default SMTPS port. | ||
- Note, if the port ends with `465` Implicit TLS/SMTPS/SMTP over TLS will be used despite this setting. | ||
- Otherwise if `IS_TLS_ENABLED=false` and the server supports `STARTTLS` this will be used. Thus if `STARTTLS` is preferred you should set `IS_TLS_ENABLED=false`. | ||
- `FROM`: **\<empty\>**: Mail from address, RFC 5322. This can be just an email address, or | ||
the "Name" \<[email protected]\> format. | ||
- `ENVELOPE_FROM`: **\<empty\>**: Address set as the From address on the SMTP mail envelope. Set to `<>` to send an empty address. | ||
- `PROTOCOL`: **\<empty\>**: Mail server protocol. One of "smtp", "smtps", "smtp+startls", "smtp+unix", "sendmail", "dummy". _Before 1.18, this was inferred from a combination of `MAILER_TYPE` and `IS_TLS_ENABLED`._ | ||
- SMTP family, if your provider does not explicitly say which protocol it uses but does provide a port, you can set SMTP_PORT instead and this will be inferred. | ||
- **sendmail** Use the operating system's `sendmail` command instead of SMTP. This is common on Linux systems. | ||
- **dummy** Send email messages to the log as a testing phase. | ||
- Note that enabling sendmail will ignore all other `mailer` settings except `ENABLED`, `FROM`, `SUBJECT_PREFIX` and `SENDMAIL_PATH`. | ||
- Enabling dummy will ignore all settings except `ENABLED`, `SUBJECT_PREFIX` and `FROM`. | ||
- `SMTP_ADDR`: **\<empty\>**: Mail server address. e.g. smtp.gmail.com. For smtp+unix, this should be a path to a unix socket instead. _Before 1.18, this was combined with `SMTP_PORT` under the name `HOST`._ | ||
- `SMTP_PORT`: **\<empty\>**: Mail server port. If no protocol is specified, it will be inferred by this setting. Common ports are listed below. _Before 1.18, this was combined with `SMTP_ADDR` under the name `HOST`._ | ||
- 25: insecure SMTP | ||
- 465: SMTP Secure | ||
- 587: StartTLS | ||
- `USE_CLIENT_CERT`: **false**: Use client certificate for TLS/SSL. | ||
- `CLIENT_CERT_FILE`: **custom/mailer/cert.pem**: Client certificate file. | ||
- `CLIENT_KEY_FILE`: **custom/mailer/key.pem**: Client key file. | ||
- `FORCE_TRUST_SERVER_CERT`: **false**: If set to `true`, completely ignores server certificate validation errors. This option is unsafe. Consider adding the certificate to the system trust store instead. | ||
- `USER`: **\<empty\>**: Username of mailing user (usually the sender's e-mail address). | ||
- `PASSWD`: **\<empty\>**: Password of mailing user. Use \`your password\` for quoting if you use special characters in the password. | ||
- Please note: authentication is only supported when the SMTP server communication is encrypted with TLS (this can be via `STARTTLS`) or `HOST=localhost`. See [Email Setup]({{< relref "doc/usage/email-setup.en-us.md" >}}) for more information. | ||
- `SEND_AS_PLAIN_TEXT`: **false**: Send mails as plain text. | ||
- `SKIP_VERIFY`: **false**: Whether or not to skip verification of certificates; `true` to disable verification. | ||
- **Warning:** This option is unsafe. Consider adding the certificate to the system trust store instead. | ||
- **Note:** Gitea only supports SMTP with STARTTLS. | ||
- `USE_CERTIFICATE`: **false**: Use client certificate. | ||
- `CERT_FILE`: **custom/mailer/cert.pem** | ||
- `KEY_FILE`: **custom/mailer/key.pem** | ||
- Please note: authentication is only supported when the SMTP server communication is encrypted with TLS (this can be via `STARTTLS`) or SMTP host is localhost. See [Email Setup]({{< relref "doc/usage/email-setup.en-us.md" >}}) for more information. | ||
- `ENABLE_HELO`: **true**: Enable HELO operation. | ||
- `HELO_HOSTNAME`: **(retrieved from system)**: HELO hostname. | ||
- `FROM`: **\<empty\>**: Mail from address, RFC 5322. This can be just an email address, or the "Name" \<[email protected]\> format. | ||
- `ENVELOPE_FROM`: **\<empty\>**: Address set as the From address on the SMTP mail envelope. Set to `<>` to send an empty address. | ||
- `SUBJECT_PREFIX`: **\<empty\>**: Prefix to be placed before e-mail subject lines. | ||
- `MAILER_TYPE`: **smtp**: \[smtp, sendmail, dummy\] | ||
- **smtp** Use SMTP to send mail | ||
- **sendmail** Use the operating system's `sendmail` command instead of SMTP. | ||
This is common on Linux systems. | ||
- **dummy** Send email messages to the log as a testing phase. | ||
- Note that enabling sendmail will ignore all other `mailer` settings except `ENABLED`, | ||
`FROM`, `SUBJECT_PREFIX` and `SENDMAIL_PATH`. | ||
- Enabling dummy will ignore all settings except `ENABLED`, `SUBJECT_PREFIX` and `FROM`. | ||
- `SENDMAIL_PATH`: **sendmail**: The location of sendmail on the operating system (can be | ||
command or full path). | ||
- `SENDMAIL_ARGS`: **_empty_**: Specify any extra sendmail arguments. (NOTE: you should be aware that email addresses can look like options - if your `sendmail` command takes options you must set the option terminator `--`) | ||
- `SENDMAIL_PATH`: **sendmail**: The location of sendmail on the operating system (can be command or full path). | ||
- `SENDMAIL_ARGS`: **\<empty\>**: Specify any extra sendmail arguments. (NOTE: you should be aware that email addresses can look like options - if your `sendmail` command takes options you must set the option terminator `--`) | ||
- `SENDMAIL_TIMEOUT`: **5m**: default timeout for sending email through sendmail | ||
- `SENDMAIL_CONVERT_CRLF`: **true**: Most versions of sendmail prefer LF line endings rather than CRLF line endings. Set this to false if your version of sendmail requires CRLF line endings. | ||
- `SEND_BUFFER_LEN`: **100**: Buffer length of mailing queue. **DEPRECATED** use `LENGTH` in `[queue.mailer]` | ||
- `SEND_AS_PLAIN_TEXT`: **false**: Send mails only in plain text, without HTML alternative. | ||
|
||
## Cache (`cache`) | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.