Command line arguments - Thunderbird
Thunderbird supports the following command line arguments:
- All of the Mozilla command line arguments that aren't browser specific. However, you need to figure out what version of Gecko your version of Thunderbird uses to see if some of those command line arguments aren't available. Thunderbird 3.1 is based on Gecko 1.9.2. The -install-global-extension and -install-global-theme arguments have been removed from Gecko 1.9.2 and later versions.
Notice the syntax section at the bottom of that writeup. You can use -compose message_options to have it bring up the compose message window and fill in everything for you, but you still need to press the Send button to actually send the message.
- Command line arguments for the extension manager. It's used for a number of troubleshooting or system administration tasks such as running in Safe Mode.
- The -profile "path" (or -P "path") command line argument to specify the location of the profile. It's used to run Thunderbird with the specified profile regardless of whether the Profile Manager knows about that profile's existence. It's described in more detail in the writeup on USB drive support but it does not require a USB drive. Its useful if you're a roaming user or Thunderbird somehow lost track of your profile (perhaps due to your system crashing) and you want to verify the profile is still good before trying to fix the problem. Example: "C:\Program Files\Mozilla Thunderbird\thunderbird.exe" -profile e:\my_profile will launch Thunderbird with the profile stored at e:\my_profile. A quick sanity check is that e:\my_profile should contain your prefs.js file. Note however that you normally cannot start Thunderbird with a second profile if Thunderbird is already running.
- The -migration command line argument opens import wizard which help with import data from Outlook (Express) and Mozilla Suite/SeaMonkey.
- The path of a .eml file. This will launch Thunderbird with a window displaying the contents of the .eml file. For example, "C:\Program Files\Thunderbird\thunderbird.exe" c:\test.eml
- The -mail URL command line argument opens the message whose URL you specified. Select the message in Thunderbird, enter var hdr = top.opener.gFolderDisplay.selectedMessage; alert(hdr.folder.getUriForMsg(hdr)); in the error console and press the evaluate button to get a popup with the URL. You can't specify the URL for a folder, only for a specific message.  For example: thunderbird.exe -mail "mailbox-message://firstname.lastname@example.org/Templates#12345"
- The "-addressbook" command line argument opens the address book.
Compose new mail with command line
You have to use the command line option "-compose" to launch Thunderbird and open a new compose window. The following arguments for this option are available:
- "to" : used to specify the email of the recipient
- "cc" : used to specify the email of the recipient of a copy of the mail
- "bcc" : used to specify the email of the recipient of a blind copy of the mail*
- "newsgroups" : one or more news groups to submit the message to*
- "subject" : subject of the mail
- "format" : compose the message in HTML ("format=1") or plain text ("format=2")*
- with TB 52+ instead of the numbers you can also write strings like "html" or "text" which are not case sensitive
- "from" : set the from email address here if you have multiple identities and don't want the default one (available in TB 52+)
- "preselectid" : an identifier for the "From" identity to choose from the menu (obsolete with TB 52+; see the "from" argument)*
- note that you cannot directly specify an e-mail address but need to find the identity key
- for example, "preselectid=id2" would select the identity #2
- you can find the key by try-and-error or by searching for "useremail" in the Config Editor
- "body" : body of the mail
- "message" : specify a plain text or an HTML file with UTF-8 encoding for the body of the mail (available in TB 52+).
- Piping is supported to some degree. On some systems you can specify it this way: message=/dev/stdin
- "attachment" : specify the directory and the name of an attachment
- the value should be a file:// url, properly encoded
- with tb3+, you can alternatively use the absolute file name (unencoded)
*(in Thunderbird 3.1.9 and earlier, these options must be preceded by at least one other option and cannot be at the start of the argument list due to bug 627999.)
Watch out for the somewhat complex syntax of the "-compose" command-line option. The double-quotes enclose the full comma-separated list of arguments passed to "-compose", whereas single quotes are used to group items for the same argument. Example:
- thunderbird -compose "email@example.com,firstname.lastname@example.org',email@example.com',subject='dinner',body='How about dinner tonight?',attachment='C:\temp\info.doc,C:\temp\food.doc'"
- (use attachment="file:///C:/temp/food.doc" for Thunderbird 2.0)
For mailto: urls the "in-reply-to" header is also supported
- "in-reply-to" : adds In-Reply-To with the provided reference, adds it to References
Profile Data protection
Some users have multiple installations of Firefox on the same PC. The Firefox developers decided they wanted a dedicated profile per installation to make Firefox more stable when switching installations. This also makes it easier not to worry about backwards compatibility. Since Thunderbird uses the Mozilla Toolkit it inherited this feature in the version 68 beta.
- You may need to edit the Thunderbird shortcut to use -P to specify the profiles location.
- If you get a "You've launched an older version of Firefox" error message edit the Thunderbird shortcut to add -allow-downgrade . In the future you will need to use that if you want to use an older version of Thunderbird with an existing profile.
- Command line arguments
- Run multiple copies of Thunderbird at the same time
- Start Address Book from command line
- Compose a message in a batch file
- Mailto: URL
- The ThunderLink add-on can be used to create a string that will launch Thunderbird and display the selected message.
- VB6 example
- Dedicated profiles per Firefox installation