為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

How to retrieve or change the smtp server by command line?

  • 2 回覆
  • 4 有這個問題
  • 24 次檢視
  • 最近回覆由 Elwoodb

more options

Imagine that 200 people in a company use Thunderbird. The SMTP server needs to be changed. So how is it possible to retrieve or change the smtp server by command line? So that we can update the smtp on every 200 account automatically.

Thanks.

Imagine that 200 people in a company use Thunderbird. The SMTP server needs to be changed. So how is it possible to retrieve or change the smtp server by command line? So that we can update the smtp on every 200 account automatically. Thanks.

被選擇的解決方法

I suggest you write a script to search prefs.js in the users' profiles for the relevant smtp server setting. You can then extract the internal numerical identifier and use that to locate the relevant settings.

e.g.

these are all the entries referring to the smtp server for my gmx account.

user_pref("mail.smtpserver.smtp21.authMethod", 3);
user_pref("mail.smtpserver.smtp21.description", "GMX SMTP");
user_pref("mail.smtpserver.smtp21.hostname", "mail.gmx.com");
user_pref("mail.smtpserver.smtp21.port", 465);
user_pref("mail.smtpserver.smtp21.try_ssl", 3);
user_pref("mail.smtpserver.smtp21.username", "???@gmx.co.uk");

I don't know what you wish to change. Grepping for the hostname and changing it in-situ is fairly easy; if you need to adjust other parameters, you'd also need to find all the relevant entries containing, in this example, "smtp21".

A few years ago I'd have done this in C; now I'd use Python. I suspect it could be done with grep, and most definitely with awk or sed, but I've never got to grips with them. ;-)

If you're changing authorization or security options, you'll need to do the homework to understand the relevance of the numerical arguments.

Please ensure Thunderbird is closed down whilst doing this, else it is likely to overwrite your changes.

從原來的回覆中察看解決方案 👍 1

所有回覆 (2)

more options

選擇的解決方法

I suggest you write a script to search prefs.js in the users' profiles for the relevant smtp server setting. You can then extract the internal numerical identifier and use that to locate the relevant settings.

e.g.

these are all the entries referring to the smtp server for my gmx account.

user_pref("mail.smtpserver.smtp21.authMethod", 3);
user_pref("mail.smtpserver.smtp21.description", "GMX SMTP");
user_pref("mail.smtpserver.smtp21.hostname", "mail.gmx.com");
user_pref("mail.smtpserver.smtp21.port", 465);
user_pref("mail.smtpserver.smtp21.try_ssl", 3);
user_pref("mail.smtpserver.smtp21.username", "???@gmx.co.uk");

I don't know what you wish to change. Grepping for the hostname and changing it in-situ is fairly easy; if you need to adjust other parameters, you'd also need to find all the relevant entries containing, in this example, "smtp21".

A few years ago I'd have done this in C; now I'd use Python. I suspect it could be done with grep, and most definitely with awk or sed, but I've never got to grips with them. ;-)

If you're changing authorization or security options, you'll need to do the homework to understand the relevance of the numerical arguments.

Please ensure Thunderbird is closed down whilst doing this, else it is likely to overwrite your changes.

由 Zenos 於 修改

more options

Many thanks Zenos. I overlooked this file. :-) I'll do a login script that will be executed before TB starts.