diff options
author | KN4CK3R | 2023-01-14 16:57:10 +0100 |
---|---|---|
committer | GitHub | 2023-01-14 23:57:10 +0800 |
commit | fc037b4b825f0501a1489e10d7c822435d825cb7 (patch) | |
tree | 551590b5ec197d8efca8b7bc3a9acc5961637d9d /docs | |
parent | 20e3ffd2085d7066b3206809dfae7b6ebd59cb5d (diff) |
Add support for incoming emails (#22056)
closes #13585
fixes #9067
fixes #2386
ref #6226
ref #6219
fixes #745
This PR adds support to process incoming emails to perform actions.
Currently I added handling of replies and unsubscribing from
issues/pulls. In contrast to #13585 the IMAP IDLE command is used
instead of polling which results (in my opinion π) in cleaner code.
Procedure:
- When sending an issue/pull reply email, a token is generated which is
present in the Reply-To and References header.
- IMAP IDLE waits until a new email arrives
- The token tells which action should be performed
A possible signature and/or reply gets stripped from the content.
I added a new service to the drone pipeline to test the receiving of
incoming mails. If we keep this in, we may test our outgoing emails too
in future.
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/content/doc/advanced/config-cheat-sheet.en-us.md | 14 | ||||
-rw-r--r-- | docs/content/doc/features/comparison.en-us.md | 2 | ||||
-rw-r--r-- | docs/content/doc/features/comparison.zh-cn.md | 2 | ||||
-rw-r--r-- | docs/content/doc/features/comparison.zh-tw.md | 2 | ||||
-rw-r--r-- | docs/content/doc/usage/incoming-email.en-us.md | 47 |
5 files changed, 64 insertions, 3 deletions
diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index def731472..7dbcad6b4 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -750,6 +750,20 @@ and - `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. +## Incoming Email (`email.incoming`) + +- `ENABLED`: **false**: Enable handling of incoming emails. +- `REPLY_TO_ADDRESS`: **\<empty\>**: The email address including the `%{token}` placeholder that will be replaced per user/action. Example: `incoming+%{token}@example.com`. The placeholder must appear in the user part of the address (before the `@`). +- `HOST`: **\<empty\>**: IMAP server host. +- `PORT`: **\<empty\>**: IMAP server port. +- `USERNAME`: **\<empty\>**: Username of the receiving account. +- `PASSWORD`: **\<empty\>**: Password of the receiving account. +- `USE_TLS`: **false**: Whether the IMAP server uses TLS. +- `SKIP_TLS_VERIFY`: **false**: If set to `true`, completely ignores server certificate validation errors. This option is unsafe. +- `MAILBOX`: **INBOX**: The mailbox name where incoming mail will end up. +- `DELETE_HANDLED_MESSAGE`: **true**: Whether handled messages should be deleted from the mailbox. +- `MAXIMUM_MESSAGE_SIZE`: **10485760**: Maximum size of a message to handle. Bigger messages are ignored. Set to 0 to allow every size. + ## Cache (`cache`) - `ENABLED`: **true**: Enable the cache. diff --git a/docs/content/doc/features/comparison.en-us.md b/docs/content/doc/features/comparison.en-us.md index 9baa6d512..87b2f43de 100644 --- a/docs/content/doc/features/comparison.en-us.md +++ b/docs/content/doc/features/comparison.en-us.md @@ -106,7 +106,7 @@ _Symbols used in table:_ | Issue search | β | β | β | β | β | β | β | | Global issue search | [/](https://github.com/go-gitea/gitea/issues/2434) | β | β | β | β | β | β | | Issue dependency | β | β | β | β | β | β | β | -| Create issue via email | [β](https://github.com/go-gitea/gitea/issues/6226) | β | β | β | β | β | β | +| Create issue via email | [β](https://github.com/go-gitea/gitea/issues/6226) | β | β | β | β | β | β | | Service Desk | [β](https://github.com/go-gitea/gitea/issues/6219) | β | β | β | β | β | β | ## Pull/Merge requests diff --git a/docs/content/doc/features/comparison.zh-cn.md b/docs/content/doc/features/comparison.zh-cn.md index aaf8eb4ab..c5bec58cb 100644 --- a/docs/content/doc/features/comparison.zh-cn.md +++ b/docs/content/doc/features/comparison.zh-cn.md @@ -92,7 +92,7 @@ _θ‘¨ζ ΌδΈη符ε·ε«δΉ:_ | ε·₯εζη΄’ | β | β | β | β | β | β | β | | ε·₯εε
¨ε±ζη΄’ | [β](https://github.com/go-gitea/gitea/issues/2434) | β | β | β | β | β | β | | ε·₯εδΎθ΅ε
³η³» | β | β | β | β | β | β | β | -| ιθΏ Email εε»Ίε·₯ε | [β](https://github.com/go-gitea/gitea/issues/6226) | [β](https://github.com/gogs/gogs/issues/2602) | β | β | β | β | β | +| ιθΏ Email εε»Ίε·₯ε | [β](https://github.com/go-gitea/gitea/issues/6226) | [β](https://github.com/gogs/gogs/issues/2602) | β | β | β | β | β | | ζε‘ε° | [β](https://github.com/go-gitea/gitea/issues/6219) | β | β | [β](https://gitlab.com/groups/gitlab-org/-/epics/3103) | β | β | β | #### Pull/Merge requests diff --git a/docs/content/doc/features/comparison.zh-tw.md b/docs/content/doc/features/comparison.zh-tw.md index 015955f0a..4da9c74ec 100644 --- a/docs/content/doc/features/comparison.zh-tw.md +++ b/docs/content/doc/features/comparison.zh-tw.md @@ -93,7 +93,7 @@ menu: | ει‘ζε° | β | β | β | β | β | β | β | | ε
¨εει‘ζε° | [β](https://github.com/go-gitea/gitea/issues/2434) | β | β | β | β | β | β | | ει‘ηΈδΎ | β | β | β | β | β | β | β | -| εΎι»ει΅δ»Άε»Ίη«ει‘ | [β](https://github.com/go-gitea/gitea/issues/6226) | [β](https://github.com/gogs/gogs/issues/2602) | β | β | β | β | β | +| εΎι»ει΅δ»Άε»Ίη«ει‘ | [β](https://github.com/go-gitea/gitea/issues/6226) | [β](https://github.com/gogs/gogs/issues/2602) | β | β | β | β | β | | ζεε° | [β](https://github.com/go-gitea/gitea/issues/6219) | β | β | [β](https://gitlab.com/groups/gitlab-org/-/epics/3103) | β | β | β | ## ζε/ε佡θ«ζ± diff --git a/docs/content/doc/usage/incoming-email.en-us.md b/docs/content/doc/usage/incoming-email.en-us.md new file mode 100644 index 000000000..9f1f28e66 --- /dev/null +++ b/docs/content/doc/usage/incoming-email.en-us.md @@ -0,0 +1,47 @@ +--- +date: "2022-12-01T00:00:00+00:00" +title: "Incoming Email" +slug: "incoming-email" +draft: false +toc: false +menu: + sidebar: + parent: "usage" + name: "Incoming Email" + weight: 13 + identifier: "incoming-email" +--- + +# Incoming Email + +Gitea supports the execution of several actions through incoming mails. This page describes how to set this up. + +**Table of Contents** + +{{< toc >}} + +## Requirements + +Handling incoming email messages requires an IMAP-enabled email account. +The recommended strategy is to use [email sub-addressing](https://en.wikipedia.org/wiki/Email_address#Sub-addressing) but a catch-all mailbox does work too. +The receiving email address contains a user/action specific token which tells Gitea which action should be performed. +This token is expected in the `To` and `Delivered-To` header fields. + +Gitea tries to detect automatic responses to skip and the email server should be configured to reduce the incoming noise too (spam, newsletter). + +## Configuration + +To activate the handling of incoming email messages you have to configure the `email.incoming` section in the configuration file. + +The `REPLY_TO_ADDRESS` contains the address an email client will respond to. +This address needs to contain the `%{token}` placeholder which will be replaced with a token describing the user/action. +This placeholder must only appear once in the address and must be in the user part of the address (before the `@`). + +An example using email sub-addressing may look like this: `incoming+%{token}@example.com` + +If a catch-all mailbox is used, the placeholder may be used anywhere in the user part of the address: `incoming+%{token}@example.com`, `incoming_%{token}@example.com`, `%{token}@example.com` + +## Security + +Be careful when choosing the domain used for receiving incoming email. +It's recommended receiving incoming email on a subdomain, such as `incoming.example.com` to prevent potential security problems with other services running on `example.com`. |