identities API
The identities API first appeared in Thunderbird 91.
Permissions
Create, modify or delete your mail account identities
Functions
list([accountId])
Returns the identities of the specified account, or all identities if no account is specified. Do not expect the returned identities to be in any specific order. Use getDefault(accountId) to get the default identity of an account.
Parameters
[accountId
]
(string, optional)
Return type (Promise)
array of MailIdentity
Required permissions
get(identityId)
Returns details of the requested identity, or null if it doesn’t exist.
Parameters
identityId
(string)
Return type (Promise)
Required permissions
create(accountId, details)
Create a new identity in the specified account.
Return type (Promise)
Required permissions
delete(identityId)
Attempts to delete the requested identity. Default identities cannot be deleted.
Parameters
identityId
(string)
Required permissions
update(identityId, details)
Updates the details of an identity.
Return type (Promise)
Required permissions
getDefault(accountId)
Returns the default identity for the requested account, or null if it is not defined.
Parameters
accountId
(string)
Return type (Promise)
Required permissions
setDefault(accountId, identityId)
Sets the default identity for the requested account.
Parameters
accountId
(string)
identityId
(string)
Required permissions
Events
onCreated
Fired when a new identity has been created and added to an account. The event also fires for default identities that are created when a new account is added.
Parameters for onCreated.addListener(listener)
listener(identityId, identity)
A function that will be called when this event occurs.
Required permissions
onDeleted
Fired when an identity has been removed from an account.
Parameters for onDeleted.addListener(listener)
listener(identityId)
A function that will be called when this event occurs.
Parameters passed to the listener function
identityId
(string)
Required permissions
onUpdated
Fired when one or more properties of an identity have been modified. The returned MailIdentity includes only the changed values.
Parameters for onUpdated.addListener(listener)
listener(identityId, changedValues)
A function that will be called when this event occurs.
Required permissions
Types
MailIdentity
– [Added in TB 76]
object
[accountId
]
(string, optional)
The id of the MailAccount this identity belongs to. The accountId
property is read-only.
[composeHtml
]
(boolean, optional)
– [Added in TB 85, backported to TB 78.7.0]
If the identity uses HTML as the default compose format.
[email
]
(string, optional)
The user’s email address as used when messages are sent from this identity.
[id
]
(string, optional)
A unique identifier for this identity. The id
property is read-only.
[label
]
(string, optional)
A user-defined label for this identity.
[name
]
(string, optional)
The user’s name as used when messages are sent from this identity.
[organization
]
(string, optional)
The organization associated with this identity.
[replyTo
]
(string, optional)
The reply-to email address associated with this identity.
[signature
]
(string, optional)
– [Added in TB 91]
The signature of the identity.
[signatureIsPlainText
]
(boolean, optional)
– [Added in TB 91]
If the signature should be interpreted as plain text or as HTML.