- Command line arguments — Thunderbird
- Contents
- Compose new mail with command line
- Profile Data protection
- See also
- External links
- thunderbird
- USAGE
- OPTIONS
- X11 options
- Mozilla options
- DEBUGGING
- ENVIRONMENT
- FILES
- EXAMPLES
- Some typical use case for starting Thunderbird from a console
- BUGS
- AUTHORS
- Thunderbird operations through the command line
- 1 Answer 1
- How can I launch Thunderbird from Command Line and Auto Check IMAP Email?
- 3 Answers 3
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. [1] For example: thunderbird.exe -mail «mailbox-message://user%40gmail.com@pop.googlemail.com/Templates#12345»
- The «-addressbook» command line argument opens the address book.
Contents
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
- 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
- Piping is supported to some degree. On some systems you can specify it this way: message=/dev/stdin
- 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'»
For mailto: urls the «in-reply-to» header is also supported
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.
See also
External links
- 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
thunderbird
Thunderbird provides IMAP/POP support, a built-in RSS reader, support for HTML mail, powerful quick search, saved search folders, advanced message filtering, junk mail controls, message grouping, labels, return receipts, smart address book, LDAP address completion, import tools and the ability to manage multiple identities in email and newsgroup accounts.
Thunderbird provides enterprise and government grade security such as S/MIME, digital signing, message encryption, and support for certificates and security devices.
USAGE
thunderbird is a executable file that will set up the environment for the starting executable, thunderbird-bin. If there is an Thunderbird mail client already running, thunderbird will arrange for it to create a new mail client window; otherwise it will start the Thunderbird application.
OPTIONS
A summary of the options supported by thunderbird is included below.
X11 options
Mozilla options
Print the Thunderbird version.
Start with profile. When no profile is given, displays the Profile Manager. May require -no-remote, see below.
Start with with [profile] from the given [path].
Start with migration wizard. May require -no-remote, see below.
Start with profile manager. May require -no-remote, see below.
Don’t connect to a running Thunderbird instance. Don’t accept or send remote commands. This option can be necessary in conjunction to several of the options above, that won’t have any effect when an Thunderbird instance is running unless -no-remote is used at the same time.
Open a new instance instead of a new windows in the running instance.
Start with locale resources as User Interface locale. By default, it is guessed from environment and available locales for Thunderbird.
Starts Thunderbird in safe mode, i.e. disabling all extensions and showing a bit more debugging messages.
Start with Javascript Console
Open the address book at startup.
Compose a mail or news message.
Open the mail folder view.
Open the message specified by this URL.
Set Thunderbird as the default mail client.
Open the specified email file.
DEBUGGING
Starts Thunderbird through a debugger (gdb by default).
ENVIRONMENT
MOZILLA_DISABLE_PLUGINS — when set, totally disables loading plugins.
FILES
/usr/bin/thunderbird — shell script wrapping thunderbird-bin
/usr/lib/thunderbird/thunderbird-bin — thunderbird executable
EXAMPLES
Some typical use case for starting Thunderbird from a console
Starting Thunderbird without any extra options, useful to any messages from thunderbird in case something went not o.k.:
Starting Thunderbird without any extensions or themes, useful if extensions may make some trouble:
Starting Thunderbird with a composing window:
Starting Thunderbird with the default debugger:
/usr/lib/thunderbird/run-mozilla.sh -debug /usr/lib/thunderbird/thunderbird-bin
Starting Thunderbird with the specific debugger:
/usr/lib/thunderbird/run-mozilla.sh --debugger /foo/bar/debugger /usr/lib/thunderbird/thunderbird-bin
BUGS
To report a bug, please visit http://bugzilla.mozilla.org/ and/or report bugs to the Debian Bug Tracking System, as usual.
AUTHORS
The Mozilla Organization
Thunderbird operations through the command line
pacman -S mutt . Seriously, if you want a command line mail client. thunderbird —help will tell you how it is only built for a GUI.
Thanks but I am not looking for a command line mail client. I am looking for a way to trigger two specific commands in Thunderbird through the command line.
have you tried xdotool ? e.g. something like xdotool search —name thunderbird key shift+F5 . see man xdotool for more info, and note that some programs ignore events sent by xdotool, and/or ignore such events when not in focus.
Thanks @cas! I’ve been trying to use xdotool but so far no luck. I can’t get Thunderbird to accept any input. Using i3 as window manager which may complicate things, although there seem to be other reports of Thunderbird not taking any ‘synthetic’ inputs.
1 Answer 1
@cas’ suggestion to use xdotool works. Not sure why previous attempts by OP weren’t successful, perhaps a combination of Thunderbird updates and use of correct syntax.
The following command finds windows with Thunderbird in their name and sends the Get All New Messages key sequence to the first of the found windows:
xdotool search —name «Mozilla Thunderbird» key —window %1 shift+F5
Thanks to this thread I was able to set up KDE Connect to use my mobile to tell my laptop to download emails.
The way xdotool ‘s window search works is best explained in its manpages, but in short: it builds a memory structure containing all windows that matched your criteria. How these results are sorted in memory is not in user’s control, so when referring to the first window in the results ( %1 ), you don’t know which one it is. This could be the most common reason for xdotool invocations to have no effect: keys could be sent to the wrong window. To prevent it, try to set window search parameters to return just one window. It is tempting to replace %1 with %@ (all matched windows), but this may include applications where the keys activate an action you don’t want.
How can I launch Thunderbird from Command Line and Auto Check IMAP Email?
I want to use Thunderbird as an IMAP client to backup Gmail and would prefer to run it from a CRON. Basically want to wake it up, sync IMAP folders than shutdown. I tried offlineIMAP with no success and it seems that Thunderbird is a reasonable solution. What would the command line settings be to have it check, download, then shutdown?
If you want to backup Gmail you need to use POP not IMAP as IMAP only shows you what is on your server it doesn’t download anything.
@Allan, that isn’t strictly true. You can download IMAP content for later use, however, if a message is deleted from Gmail, when you sync your local imap it’ll be deleted locally, too.
3 Answers 3
Perhaps fetchmail would be better suited to what you’re trying to accomplish? http://www.fetchmail.info/
I believe you can launch Thunderbird by just typing thunderbird in the terminal. As to auto checking, I believe Thunderbird has an option (burred in the settings somewhere) to check for new mail at start up. Also be sure that you’re fetching the entire messages with IMAP and not just the headers. Otherwise it wont exactly be a backup.
If you just want to backup your Gmail account, maybe should you have a look at this post.
It’s about the Backup Gmail script.
You can also set up automated incremental backups if i’m right (haven’t personally tested it).Usage: backup_gmail.py backup_dir email@address password Options: -h, --help show this help message and exit -r, --restore Restore backup to online gmail account -i, --inc Use incremental backup -k, --keep_status Keep the mail read status (Slow) -s START_DATE, --start=START_DATE Backup mail starting from this date. Format: 30-Jan-2010 -e END_DATE, --end=END_DATE Backup mail until to this date Format: 30-Jan-2010 --include=INCLUDE_LABELS Only backup these labels. Separate labels by '^' Format: label1^label2 --exclude=EXCLUDE_LABELS Do not backup these labels. If --include is used this flag will be ignored. Separate labels by '^' Format: label1^label2 -c CONFIG_FILE, --config=CONFIG_FILE Load setting from config file -p PROFILE, --profile=PROFILE Use this profile in the config file.