Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

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

  • 2 replies
  • 4 have this problem
  • 24 views
  • Last reply by 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.

Chosen solution

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", "[email protected]");

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.

Read this answer in context 👍 1

All Replies (2)

more options

Chosen Solution

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", "[email protected]");

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.

Modified by Zenos

more options

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