Managing IMAP accounts with Trojitá

Slashdot it! Delicious Share on Facebook Tweet! Digg!
scanrail, 123RF

scanrail, 123RF

Netting Mail

Gone are the days when we read email solely sitting at our computers. To read messages on the move, we now have IMAP, which has completely displaced POP. Trojitá makes IMAP easy, even with accounts with big folders.

The large KDE SC and Gnome desktop environments include extensive groupware functions with KMail and Evolution. However, until recently no mail program has existed for the Qt environment that just manages mails, such as Claws Mail and Sylpheed do for GTK.

In 2006, Jan Kundrát developed Trojitá [1] as a Qt/C++ application [2] based on an earlier attempt in Python. He describes the background in a series of blog articles [3], including what he didn't like about other IMAP clients and what motivated him to start his current project [4].

Kundrát explained why simply improving KMail, which at the time was not yet based on Akonadi [5], wasn't the answer. His reason was primarily the current IMAP structure, which was used in many places, and still is, but has some flaws. Even today, KMail still doesn't support deleting emails from other IMAP clients with the corresponding flag [6].

Unlike Claws Mail and Sylpheed, Trojitá is limited to IMAP and doesn't support POP3 accounts. It also doesn't maintain any plugins except for a single one for password storage security. These restrictions, however, make it easier to develop and make it a fast and efficient client. The software was originally integrated with Ubuntu Touch, but Jan Kundrát removed this integration in October of 2014 [7] because the Touch developers pursued their own fork, Dekko [8].

The central promise of the developer is that Trojitá opens large mailboxes quickly and uses both main memory and CPU efficiently. To do this, the program uses several advanced IMAP features, such as QRESYNC and CONDSTORE for fast mailbox synchronization, and CONTEXT=SEARCH for live search [9].

Unlike programs that began as POP3 clients, Trojitá was especially designed from the outset as an IMAP client. The latest release, version 0.4, promises even further improvements.

According to developers, it synchronizes large mailboxes up to 10 times faster than other clients and saves up to 40 percent memory [10]. Among the program's special features is loading only as much data as the users' view requires, thus you can open mailboxes with 100,000 emails without having to wait for the software to create a full index [11].


The developers offer the program through the openSUSE Build Service [12] as a package for Fedora, RHEL/CentOS, openSUSE, Debian, and Ubuntu, as well as the source code [13]. Nightly builds [14] provide several enhancements for version 0.4.1. Thanks to Qt's platform independence, Trojitá also runs on Windows and Mac OS X. However, the website currently refers only to the Windows installation.

To take a look at the full functionality, the nightly builds are the best option, because they enable encrypted password storage through Qt keychains [15], unlike the released version.

Keychains use the Gnome Keyring or KWallet Manager for KDE, thereby also supporting Windows and MacOS X. The nightly builds are in English only, with the released version interface translated into other languages.

The translated versions come from a different repository and the openSUSE Build Service currently doesn't run the Python script that loads them. This article, therefore, is based on the English-only version.

To install with the package manager, click your distribution's logo and follow the instructions. For Ubuntu 14.04, the first line in Listing 1 adds the release GPG key to the APT keychain. Line 1 configures the corresponding repository. Using the package manager, you then install either the trojita package for the current release or trojita-nightly for the nightly builds. For secure password storage, also install the trojita-plugin-qtkeychain package.

Listing 1

Install Using Package Manager

$ wget -q -O-\
  trojita/xUbuntu_14.04/Release.key | apt-key add -
$ sudo sh -c "echo 'deb\
  /trojita/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/trojita-nightly.list"

If you later want to switch from the nightly build to the release version, uninstall the trojita-nightly package first. If you don't, you will get a missing conflict error message that prevents concurrent installations. The same applies if you want to install the nightly after installing the release build.

Another option is building the software directly from the sources (see the "Compile It Yourself" box), which you could do if the nightly build is not the latest version.

Compile It Yourself

To begin, download the Trojitá source code using the first line in Listing 2. If you want to update it later, use the git pull command. Debian and Ubuntu users should get the required dependencies for the build using apt-get build-dep trojita . You get the current localized versions from the subversion repository using python .

Trojitá requires Cmake, Qt, Zlib, and for secure password storage, it needs Qt Keychain. For Debian and Ubuntu, you install the packages cmake , libqt4-dev , qt4-dev-tools for Qt Linguist, libqtwebkit-dev , zlib1g-dev , libqtkeychain-dev and ragel . Then, change to the source code directory and configure the source code using the commands on lines 2 through 5 of Listing 2.

Once Cmake runs error-free, make -j4 creates the sources, substituting the processor core value for the number after -j . With sudo make install , the program then ends up in /usr/local . In our tests, it also required calling sudo ldconfig to make the system aware of the newly installed libraries.

For Qt5, you need the Debian packages qtbase5-dev , libqt5webkit5-dev , qt5keychain-dev , qttools5-dev , and qttools5-dev-tools for the Qt5 Linguist tools. Then, use cmake -DWITH_QT5=ON , if necessary deleting the CmakeCache beforehand.

To install in a different directory or make other settings, execute ccmake .. before the cmake and adjust the settings.

Because of a bug in Qt 5.3.1, Qt failed to start with this version. Trojitá did start with Qt 5.3.2 but crashed when clicking an email. The Qt Webkit used by Qt5 loaded the browser plugin for the X2go remote desktop solution in memory, even though it's a Qt4 plugin. This error was subsequently resolved in the Qt Webkit source code [16]. After removing the x2goplugin package, the Qt5 version of Trojitá finally ran (see Figure 1).

Because cmake doesn't create a make target for removal (uninstall ) but lists the installed files, you can uninstall using cat install_manifest.txt | xargs sudo rm . To build a Debian package, use the guide in README.Debian , which explains how to build Trojitá yourself based on the files for the openSUSE Build Service. In our tests, however, the dpkg-buildpackage -b command required the -rfakeroot option.

The build dependencies for the package are in the debian/control file under Build-Depends . The dpkg-buildpackage command shows what's still missing. The -b option is still required; otherwise, the command searches for a source code tarball that doesn't exist in a Git checkout. Even though the package includes version 0.3.90 in the filename, dpkg-buildpackage builds a (not exactly current) version 0.4.1 from July 7, 2014. To avoid going too deep into the Debian packaging, you're better off going with the package in the openSUSE Build Service, as this was current at publication time

Listing 2

Build Trojitá

01 $ git clone git://
02 $ cd trojita
03 $ mkdir build
04 $ cd build
05 $ cmake ..
Figure 1: Trojitá runs with Qt5, but you need to do a few things first to make sure it's stable.


Configuring the mail client is easy in that you'll find all the settings under IMAP | Settings . On the General tab, use Add to add your name and email address. Trojitá provides the option of using multiple identities. Set Passwords to Secure storage via QtKeychain to store encrypted passwords. If you want to avoid HTML messages, activate Show plaintext emails instead of the HTML version .

Configure your accounts under IMAP (Figure 2). The program expects the usual information like server name, port, username, password, and encryption method. For Encryption , use the entry Use encryption (STARTTLS) or Force Encryption (TLS) . The latter uses IMAP port 993, and the former uses standard port 143 for encryption using STARTTLS – a method of initiating communication by means of encryption using Transport Layer Security (TLS).

Figure 2: Trojitá supports an IMAP account along with the usual options for encrypting the client-server communication.

Unlike KMail and Thunderbird, Trojitá currently supports one account at a time only. By using different profile startup files in Trojitá 0.4, with the --profilename option, you can supply a different profile name [8]; however, this isn't the best approach to creating multiple accounts.

Trojitá can start an IMAP server as a local process, such as the Dovecot server using SSH keys and the SSH agent using ssh dovecot --exec-mail imap . You also can have a local Dovecot on the laptop together with a synchronization program, such as Imapsync.

To send emails, specify under SMTP the server name, port, and encryption method. If the dialog says Trojitá is using port 25 for STARTTLS, you will have to modify it, because STARTTLS normally uses port 587. For SMTP authentication, as is now customary, enter the username and password.

Under Offline , you configure whether the software buffers messages and mailbox indexes, either permanently or for a certain number of days. The buffer is in a SQLite database in ~/.cache/ . In our tests, it stored messages for 30 days and up to 76MB.

The program creates indexes for both the folder and the entire emails in cache. This approach helps mainly to unburden and separate the IMAP server and network connection from net emails. Trojitá provides the three options Offline , Expensive Connection , and Free Access in the IMAP | Network Access menu.

Buy this article as PDF

Express-Checkout as PDF

Pages: 5

Price $0.99
(incl. VAT)

Buy Ubuntu User

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content