How to retrieve or change the smtp server by command line?
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.
Ŋuɖoɖo si wotia
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.
Xle ŋuɖoɖo sia le goya me 👍 1All Replies (2)
Ɖɔɖɔɖo si wotia
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 trɔe
Many thanks Zenos. I overlooked this file. :-) I'll do a login script that will be executed before TB starts.