go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.29k stars 5.51k forks source link

Unable to Process Incoming Emails on Aliyun Mail #32504

Open Android-KitKat opened 1 week ago

Android-KitKat commented 1 week ago

Description

I believe it is the SEARCH command in the IMAP protocol with the specified CHARSET parameter that caused the issue. The server completely rejects the CHARSET parameter, resulting in a malfunction.

We can choose to modify the existing code or switch to the v2 version of go-imap, which should resolve the issue. This is because the comments in v2 specifically mention this situation. https://github.com/emersion/go-imap/blob/3e14ef3cd2b7de584d2f27881d8e017e4f794802/imapclient/search.go#L36-L44

Gitea Version

1.22.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

2024/11/14 15:00:00 ...incoming/incoming.go:64:func1() [E] Error while processing incoming emails: could not process messages: imap search failed: invalid command or parameters
WanELQ LOGIN "git@[hidden]" "[hidden]"
WanELQ OK LOGIN completed
466sjQ SELECT INBOX
* 2 EXISTS
* 0 RECENT
* OK [UNSEEN 0]
* OK [UIDNEXT 3] Predicted next UID.
* OK [UIDVALIDITY 2] UIDs valid.
* FLAGS (\Answered \Seen \Deleted \Draft \Flagged)
* OK [PERMANENTFLAGS (\Answered \Seen \Deleted \Draft \Flagged)] Limited.
466sjQ OK [READ-WRITE] SELECT completed
ExitOw SEARCH CHARSET UTF-8 UNSEEN SMALLER 10485760
ExitOw BAD invalid command or parameters
GstFPw LOGOUT
* BYE IMAP4rev1 Server logging out
GstFPw OK LOGOUT completed

Screenshots

No response

Git Version

2.43.0

Operating System

CentOS Stream 8

How are you running Gitea?

Download the binary from Github Releases and run it using SystemD.

Related configuration:

[email.incoming]
ENABLED = true
HOST = imap.qiye.aliyun.com
PORT = 993
USE_TLS = true
REPLY_TO_ADDRESS = git+%{token}@[hidden]
USERNAME = git@[hidden]
PASSWORD = [hidden]
DELETE_HANDLED_MESSAGE = false

Database

PostgreSQL