From 9ebaa80a227eaca9c87c53ed515ade013bc2bca9 Mon Sep 17 00:00:00 2001 From: alois31 <36605164+alois31@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:34:21 +0100 Subject: [PATCH] thunderbird: set the correct SMTP server for aliases (#6177) Previously, only the main identity of an account would get the proper SMTP server assigned. Identities corresponding to aliases would not get an SMTP server assigned at all, leading to a (Thunderbird-internal) fallback to the SMTP server associated to the primary account. This is obviously wrong for non-primary accounts having aliases associated to them. Fix it by specifying the SMTP server explicitly for all identities. --- modules/programs/thunderbird.nix | 3 ++- .../modules/programs/thunderbird/thunderbird-expected-first.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/programs/thunderbird.nix b/modules/programs/thunderbird.nix index b3713f655..86ccdead4 100644 --- a/modules/programs/thunderbird.nix +++ b/modules/programs/thunderbird.nix @@ -71,6 +71,8 @@ let "mail.identity.id_${id}.openpgp_key_id" = account.gpg.key; "mail.identity.id_${id}.protectSubject" = true; "mail.identity.id_${id}.sign_mail" = account.gpg.signByDefault; + } // optionalAttrs (account.smtp != null) { + "mail.identity.id_${id}.smtpServer" = "smtp_${account.id}"; } // account.thunderbird.perIdentitySettings id; toThunderbirdAccount = account: profile: @@ -103,7 +105,6 @@ let "mail.server.server_${id}.type" = "imap"; "mail.server.server_${id}.userName" = account.userName; } // optionalAttrs (account.smtp != null) { - "mail.identity.id_${id}.smtpServer" = "smtp_${id}"; "mail.smtpserver.smtp_${id}.authMethod" = 3; "mail.smtpserver.smtp_${id}.hostname" = account.smtp.host; "mail.smtpserver.smtp_${id}.port" = diff --git a/tests/modules/programs/thunderbird/thunderbird-expected-first.js b/tests/modules/programs/thunderbird/thunderbird-expected-first.js index a0876893b..8499ef89e 100644 --- a/tests/modules/programs/thunderbird/thunderbird-expected-first.js +++ b/tests/modules/programs/thunderbird/thunderbird-expected-first.js @@ -18,6 +18,7 @@ user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ec user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.openpgp_key_id", "ABC"); user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.protectSubject", true); user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.sign_mail", false); +user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.smtpServer", "smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.useremail", "home-manager@example.com"); user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.valid", true); user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.autoEncryptDrafts", false);