Command line arguments - Thunderbird: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
(Replaced monospace font with italics per style guide.)
(22 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Thunderbird supports the following command line arguments:
Thunderbird supports the following command line arguments:


* All of the [http://www.mozilla.org/docs/command-line-args.html Mozilla command line arguments] that aren't browser specific. 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.
* All of the [http://www.mozilla.org/docs/command-line-args.html 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. <p>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.</p>


* [http://www.mozilla.org/projects/firefox/extensions/commandlineoptions.html 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]].
* [http://www.mozilla.org/projects/firefox/extensions/commandlineoptions.html 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]].
Line 7: Line 7:
* The ''-profile "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 [[Running from a_ USB drive (Thunderbird) |  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 [[Run multiple copies of Thunderbird at the same time|start Thunderbird with a second profile]] if Thunderbird is already running.
* The ''-profile "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 [[Running from a_ USB drive (Thunderbird) |  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 [[Run multiple copies of Thunderbird at the same time|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 ''-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. [http://forums.mozillazine.org/viewtopic.php?f=39&t=2937893] For example: ''thunderbird.exe -mail "mailbox-message://user%40gmail.com@pop.googlemail.com/Templates#12345"''


==Compose new mail with command line==
==Compose new mail with command line==
You have to use the command line "-compose" to launch Thunderbird and open a new compose window.
You have to use the command line option "-compose" to launch Thunderbird and open a new compose window.
The following arguments are availables:
The following arguments for this option are available:
* "to" : used to specify the email of the recipient
* "to" : used to specify the email of the recipient
* "cc" : used to specify the email of the recipient of a copy of the mail
* "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<sup>*</sup>
* "newsgroups" : one or more news groups to submit the message to<sup>*</sup>
* "subject" : subject of the mail
* "subject" : subject of the mail
* "format" : compose the message in HTML ("format=1") or plain text ("format=2")<sup>*</sup>
** 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)<sup>*</sup>
** 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 [[Modify_Thunderbird_settings|Config Editor]]
* "body" : body of the mail
* "body" : body of the mail
* "attachment' : specify the directory and the name of an attachment
* "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)


Example:
<small><sup>*</sup>(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 [https://bugzilla.mozilla.org/show_bug.cgi?id=627999 bug 627999].)</small>
thunderbird -compose to='address@provider.it',cc='address2@provider.fr',subject="something",body="Something
else",attachment="C:\Documents.7z"


==Issues for Thunderbird 1.5.0==
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 "to='john@example.com,kathy@example.com',cc='britney@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)


The ''-compose'' command line argument doesn't work correctly in Thunderbird 1.5 due to a parsing [https://bugzilla.mozilla.org/show_bug.cgi?id=316177 bug]. It generates the compose message window but none of the fields are filled in. The only workaround is to use a mailto: URL. However, this prevents you from passing an attachment due to a security restriction.
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
''thunderbird -compose "<nowiki>mailto:somebody@somewhere?cc=address@provider&subject=hi&body=something</nowiki>"''
 
This bug was fixed in 1.5.0.2


==See also==
==See also==
Line 33: Line 46:
* [[Run multiple copies of Thunderbird at the same time]]
* [[Run multiple copies of Thunderbird at the same time]]
* [[Start Address Book from command line]]
* [[Start Address Book from command line]]
==External links==
* [http://stackoverflow.com/questions/6253701/thunderbird-compose-email-in-a-batch-script-continue-to-next-command Compose a message in a batch file]
* [http://email.about.com/od/mailtoemaillinks/a/mailto_elements.htm Mailto: URL]
* [http://email.about.com/od/mailtoemaillinks/a/mailto_elements.htm Mailto: URL]
 
* The [https://addons.mozilla.org/en-US/thunderbird/addon/thunderlink/?src=search ThunderLink] add-on can be used to create a string that will launch Thunderbird and display the selected message.
* [http://forums.mozillazine.org/viewtopic.php?p=14645711#p14645711 VB6 example]
[[Category:Thunderbird]]
[[Category:Thunderbird]]

Revision as of 22:27, 27 July 2017

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.

  • The -profile "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. [1] For example: thunderbird.exe -mail "mailbox-message://user%40gmail.com@pop.googlemail.com/Templates#12345"

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 "to='john@example.com,kathy@example.com',cc='britney@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

See also

External links