Re: [PATCH] send-email: add --get-smtp-server option to fetch SMTP settings
From: Aditya Garg <hidden>
Date: 2025-07-30 15:14:40
On 29/07/25 10:40 pm, Aditya Garg wrote:
Autoconfiguring SMTP server settings is a common feature present in many email clients. In order to get the correct SMTP server settings easily, this commit adds a `--get-smtp-server` option to `git send-email`. This option attempts to fetch the SMTP server settings for a given email address via the following steps: 1. It first tries to fetch the settings from Mozilla's ISPDB at `https://autoconfig.thunderbird.net/v1.1/[domain]`. 2. If that fails, it attempts to fetch the autoconfig file from the email provider's autoconfig URL, which is typically in the format `https://autoconfig.[domain]/mail/config-v1.1.xml?emailaddress=[email]`. 3. If that also fails, it falls back to checking the MX records of the domain used in the email address to find the SMTP server. It can be useful in case of emails with custom domains. It attempts to guess the correct domain for the email from the MX records, and repeats the first 2 steps with the guessed domain. This feature is heavily inpired by the autoconfig feature in Mozilla Thunderbird. A detailed documentation about how thunderbird fetches the autoconfig settings can be found at: https://www.bucksch.org/1/projects/thunderbird/autoconfiguration/
It has a v2, which I didn't send as a reply to this by mistake: https://lore.kernel.org/git/20250730151227.12389-1-gargaditya08@live.com/T/#u (local)