emersion / go-imap

📥 An IMAP library for clients and servers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support IMAP4 ID command (RFC 1971)

quzhi1 opened this issue · comments

Can you support IMAP ID command as specified in RFC 1971? https://www.rfc-editor.org/rfc/rfc2971.html

Right… I've been holding off on that one because I think it's harmful: it enables clients and servers to implement implementation-specific workarounds instead of following the standard.

Can you explain your use-case?

The use case is Yahoo. Yahoo advise users to use id command to identify themselves. Here is the quote:

Client Indentification

The Verizon Media IMAP server supports the IMAP ID command https://www.ietf.org/rfc/rfc2971.txt to gather statistics and facilitate troubleshooting. An IMAP client connecting to the Verizon Media servers should issue the ID command with the following attributes: NAME, VERSION, OS, OS-VERSION.

NAME should be the partner name or the ID assigned during the approval process.
example: "name" "iPhone Mail"
"name" "com.android.email"
"name" "yahoo.com"

VERSION is the version of that client. It's useful when watching for changes in behavior OS & OS-VERSION are additional info for determining client environment specific issues.

A full ID command looks like this:
C: a007 ID ("name" "<'client name'>" "version" "<'client version'>" "os" "<'client os'>" "os-version" "<'client os version'>")

https://developer.yahooinc.com/imap-smtp/

Right, so it's a recommendation from Yahoo, but is there any real gain for clients which use the ID extension?

Right, so it's a recommendation from Yahoo, but is there any real gain for clients which use the ID extension?

@emersion Yes. I reached out to Yahoo, and they said if I set IMAP ID, they can detect the origin of the IMAP request, and can raise the rate limit. Also, if we do not pass the IMAP ID, they can potentially lock the Yahoo account if they see too many IMAP connections.

This is the email Yahoo sent us. Basically they ask me to pass IMAP ID as part of their IMAP agreement:
Screenshot 2024-03-20 at 09 55 03

Alright. That's quite a misuse of the ID command, but oh well.

Thanks for looking into this 🙏

@emersion Can you review this PR? Really appreciate it 🙏 #621

Done in #621.