]> git.ipfire.org Git - thirdparty/git.git/commit
send-email: finer-grained SMTP error handling
authorZheng Yuting <05zyt30@gmail.com>
Wed, 26 Mar 2025 07:52:46 +0000 (15:52 +0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Apr 2025 21:54:05 +0000 (14:54 -0700)
commit1ac402cdf3d5a82d3ba8943a452e84f54f398522
treeab2ac1a084cbc88cfb8086961ba6205f802862e7
parentce20dec4a4de8a75cbc9735538c9430e68d3c1f8
send-email: finer-grained SMTP error handling

Code captured errors but did not process them further.
This treated all failures the same without distinguishing SMTP status.

Add handle-smtp_error to extract SMTP status codes using a regex (as
defined in RFC 5321) and handle errors as follows:

- No error present:
- If a result is provided, return 1 to indicate success.
- Otherwise, return 0 to indicate failure.

- Error present with a captured three-digit status code:
- For 4yz (transient errors), return 1 and allow retries.
- For 5yz (permanent errors), return 0 to indicate failure.
- For any other recognized status code, return 1, treating it as
a transient error.

- Error present but no status code found:
- Return 1 as a transient error.

Signed-off-by: Zheng Yuting <05ZYT30@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-send-email.perl