LogoLogo
  • About Thunderbird
  • Contributing to Thunderbird
    • Getting Started Contributing
    • Setting Up A Build Environment
    • Building Thunderbird
      • Windows Build Prerequisites
      • Linux Build Prerequisites
      • macOS Build Prerequisites
      • Artifact Builds
    • Codebase Overview
      • Account Configuration
      • Address Book
      • Chat Core
        • Notifications
        • Message Styles
        • Keyboard shortcuts
        • Chat Core Protocols
        • Contacts
      • Mail Front-End
    • Tutorials and Examples
      • Hello World Example
      • Thunderbird Live Development Videos
    • Fixing a Bug
      • Bug Triaging 101
        • Bug Status Classicification
        • Bug Types
        • Garbage Collection
        • Narrow the Scope
      • Using Mercurial Bookmarks
      • Using Mercurial Queues
      • Lint and Format Code
      • Using ESLint to Format Javascript Code
      • Try Server
      • Landing a Patch
      • Care and Feeding of the Tree
    • Testing
      • Running Tests
      • Adding Tests
      • Writing Mochitest Tests
  • Planning
    • Roadmap
    • Android Roadmap
    • Supported Standards
  • Add-on Development
    • Introduction
    • What's new?
      • Manifest Version 3
    • A "Hello World" Extension Tutorial
      • Using WebExtension APIs
      • Using a Background Page
      • Using Content Scripts
    • A Guide to Extensions
      • Supported Manifest Keys
      • Supported UI Elements
      • Supported WebExtension APIs
      • Thunderbird's WebExtension API Documentation
      • Thunderbird WebExtension Examples
      • Introducing Experiments
    • A Guide to Themes
    • Developer Community
    • Documentation & Resources
      • Tips and Tricks
    • Add-on Update Guides
      • Update for Thunderbird 128
      • Update for Thunderbird 115
        • Adapt to Changes in Thunderbird 103-115
      • Update for Thunderbird 102
        • Adapt to Changes in Thunderbird 92-102
      • Update for Thunderbird 91
        • Adapt to Changes in Thunderbird 79-91
      • Update for Thunderbird 78
        • Adapt to Changes in Thunderbird 69-78
      • Update for Thunderbird 68
        • Adapt to Changes in Thunderbird 61-68
      • How to convert legacy extensions?
        • Convert wrapped WebExtensions to modern WebExtensions
        • Convert legacy WebExtensions to modern WebExtensions
        • Convert legacy overlay extension to legacy WebExtension
        • Convert legacy bootstrapped extension to legacy WebExtension
  • Releases
    • Thunderbird Channels
    • Release Cadence
    • Uplifting Fixes
    • Feature Flags
    • Tracking Fixes for Releases
    • Contributing to Release Notes
Powered by GitBook
On this page
  • The Account Manager
  • Accounts
  • Incoming Servers
  • Identities
  • SMTP

Was this helpful?

Edit on GitHub
Export as PDF
  1. Contributing to Thunderbird
  2. Codebase Overview

Account Configuration

PreviousCodebase OverviewNextAddress Book

Last updated 2 years ago

Was this helpful?

This page describes the classes and interfaces involved in configuring mail accounts.

Chat accounts use very similar mechanisms, but we won't go into that here to avoid confusion.

The Account Manager

The account manager controls the objects described here. It is defined by and implemented by .

To get to the account manager from JS, use MailServices.accounts. To get to it from C++, use mozilla::components::AccountManager::Service(). (The rest of this page will describe things in JS terms only for ease of reading.)

Accounts

Accounts are simple containers for incoming servers and identities. The are defined by and implemented by . If you're looking to use something in a mail account, you'll probably first get a reference to an nsIMsgAccount.

Accounts are identified by a key property, which is the word account and then a number. Preferences for an account have the prefix mail.accounts.accountX .

All accounts can be found at MailServices.accounts.accounts. To get a particular account, use MailServices.accounts.getAccount(accountKey).

Incoming Servers

Incoming Server objects describe a connection to a mail server, e.g. an IMAP or POP3 server, or for local mail. They are defined by and a sub-interface and implementation exists for each type of server Thunderbird can connect to.

Incoming Servers are identified by a key property, which is the word server and then a number. Preferences for an account have the prefix mail.servers.serverX .

There is a 1:1 relationship between an account and an incoming server. To get to the server from an account, use the account's incomingServer property. To get the account for a server, use MailServices.accounts.FindAccountForServer(server).

All incoming servers can be found at MailServices.accounts.allServers. To get a particular server, use MailServices.accounts.getIncomingServer(serverKey).

Identities

Identities are identified by a key property, which is the word id and then a number. Preferences for an account have the prefix mail.identity.idX .

Accounts can have any number of identities, although removing the last identity generally isn't allowed. Use the account's identities and defaultIdentity properties to access them.

Typically an identity belongs to only one account, although it's technically possible for it to belong to multiple accounts. Use MailServices.accounts.getServersForIdentity(identity) to get the server(s) for an identity, and go from there to get the accounts. (Yes, this is weird.)

All identities can be found at MailServices.accounts.allIdentities. To get a particular identity, use MailServices.accounts.getIdentity(identityKey).

SMTP

Identity objects reference SMTP servers in their smtpServerKey attribute.

All SMTP servers can be found at MailServices.smtp.servers. To get a particular server, use MailServices.smtp.getServerByKey(smtpKey).

Identities describe everything about sending mail from an account, such as the user's name and email address, which SMTP server to use, and where to put sent mail. They are defined by and implemented by .

SMTP breaks some of the pattern you might've noticed in the previous classes. The SMTP service, MailServices.smtp or mozilla::Components::Smtp::Service(), implements as .

SMTP server configuration is kept by objects implementing as . They also are identified by a key property, which is the word smtp and then a number. Preferences for an account have the prefix mail.smtpserver.smtpX .

nsIMsgAccountManager
nsMsgAccountManager
nsIMsgAccount
nsMsgAccount
nsIMsgIncomingServer
nsIMsgIdentity
nsMsgIdentity
nsISmtpService
SmtpService
nsISmtpServer
SmtpServer