DEV Community

Cover image for Install Mailspring, the Best Free Email App on Linux, in a Distrobox Container!
Archer Allstars
Archer Allstars

Posted on

Install Mailspring, the Best Free Email App on Linux, in a Distrobox Container!

From my experience, it's actually the best free, open source, and underrated email app on Linux, see its GitHub repo.

  • The GUI is sharp and modern.
  • It has an excellent built-in email language translator.
  • It follows the system's light/dark theme (using a plug-in system).
  • Many email providers are supported OOTB with single sign-on system.
  • It is able to run in the background with the obvious --background option.
  • Pro subscription is available for more features, see here!

But if you only use one email, an email client probably doesn't matter much 😂

Why Not Geary?

This is the go-to email client for many. With the adw-gtk3 theme and the Legacy (GTK3) Theme Scheme Auto Switcher GNOME extension, it blends very well with GNOME and other Adwaita apps. It also integrates with GNOME Online Accounts.

Unfortunately, its Flatpak version is plagued with a non-debuggable crashing issue (Geary issue #1679) to the point that it's unusable for me now.

And as I am on Fedora Silverblue, I am not willing to layer something like an email client... And I can't find a way to make it follow the system's light/dark theme in a container.

Therefore, I uninstalled it and never looked back.

Why not Evolution?

I don't want to use an email client with the 90s graphical interface.

Why not Thunderbird?

I want my email client to be an email client, not also a calendar client, etc.


Table of contents

  1. Install Distrobox and Podman
  2. Configure Distrobox to Use Podman
  3. Create a Container
  4. Enable x86-64-v3 Packages
  5. Install Required Packages
  6. [optional] Symlink fonts and fontconfig Directories on the Host
  7. Install Mailspring
  8. Export Mailspring to the Host
  9. Make Mailspring Follow the System’s Light/Dark Theme
  10. Make Mailspring Run In the Background on Startup and When It’s Closed
  11. Update the Container Automatically, Zero Maintenance!

1. Install Distrobox and Podman

The command will differ based on your specific package manager. Refer to your distro's docs. For example, on Arch based distros:

sudo pacman -S distrobox podman
Enter fullscreen mode Exit fullscreen mode

On Fedora Silverblue, Podman is installed by default. The rest is layering Distrobox:

sudo rpm-ostree install distrobox
Enter fullscreen mode Exit fullscreen mode

You need to reboot to use the layered package.


2. Configure Distrobox to Use Podman

echo 'container_manager="podman"' > ~/.config/distrobox/distrobox.conf
Enter fullscreen mode Exit fullscreen mode

3. Create a Container

I use openSUSE container image because:

  • It has x86-x64-v3 packages.

  • It uses a rolling release model, so I don't have to manually major upgrading my container.

distrobox-create -i registry.opensuse.org/opensuse/distrobox:latest -n email-dbx -H ~/distrobox/email-dbx --volume /run/dbus/system_bus_socket:/run/dbus/system_bus_socket
Enter fullscreen mode Exit fullscreen mode

Don't forget to add --nvidia if you have NVIDIA GPU. See more here.


4. Enable x86-64-v3 Packages

Enter the container and update all the packages first:

sudo zypper dup
Enter fullscreen mode Exit fullscreen mode

Enable x86-64-v3 packages:

sudo zypper install patterns-glibc-hwcaps-x86_64_v3
Enter fullscreen mode Exit fullscreen mode

5. Install Required Packages

sudo zypper install zenity mozilla-nspr mozilla-nss libcanberra-gtk3-module libwebkitgtk-6_0-4
Enter fullscreen mode Exit fullscreen mode

6. [optional] Symlink fonts and fontconfig Directories on the Host

This is usually necessary for multilingual individuals if they want to change the font for a specific language.

Make the Required Directories Inside the Container

mkdir -p ~/.local/share
Enter fullscreen mode Exit fullscreen mode
mkdir -p ~/.config/fontconfig
Enter fullscreen mode Exit fullscreen mode

Symlink With the Host

ln -s /var/home/archerallstars/.local/share/fonts ~/.local/share/
Enter fullscreen mode Exit fullscreen mode
ln -s /var/home/archerallstars/.config/fontconfig/conf.d ~/.config/fontconfig/
Enter fullscreen mode Exit fullscreen mode

Replace /var/home/archerallstars with your home directory!


7. Install Mailspring

Simply go to the official download page and download the .rpm package.

You can install any .rpm packages locally (inside the container) with:

sudo zypper install ./<package-name>.rpm
Enter fullscreen mode Exit fullscreen mode

For example:

sudo zypper install ./mailspring-1.16.0-0.1.x86_64.rpm
Enter fullscreen mode Exit fullscreen mode

When you're being asked about the package's signature, just ignore it (hit i).


8. Export Mailspring to the Host

distrobox-export -a mailspring
Enter fullscreen mode Exit fullscreen mode

You should see the app's icon on your app drawer on the host now.

Exit the container with exit.


9. Make Mailspring Follow the System’s Light/Dark Theme

Many thanks to Andrew Minion and his Mailspring Automatic Light-Dark Mode plug-in.

Simply download or clone the repo directory, then copy the entire directory to ~/distrobox/email-dbx/.config/Mailspring/packages

Then, in the Mailspring app, from the menu bar:

Developer > Install a Plugin...

Choose the plug-in directory in ~/distrobox/email-dbx/.config/Mailspring/packages.

The plug-in works instantly without having to restart the app. You can try switching your system them between light and dark.

After this, you can hide the ancient menu bar, as shown in the screenshot below:

Hidding the ancient menu bar

Toggle the menu bar with Alt.


10. Make Mailspring Run In the Background on Startup and When It’s Closed

OOTB, Mailspring has the system tray that would let it runs in the background looking for new emails.

But it doesn't work well, at least in GNOME.

So, I disabled it and replacing it with a systemd service.

Create a User systemd Service on the Host

nano ~/.config/systemd/user/mailspring.service
Enter fullscreen mode Exit fullscreen mode

Inside the service file:

[Unit]
Description=Mailspring
RequiresMountsFor=/run/user/1000/containers

[Service]
Type=exec
ExecStart=/usr/bin/distrobox-enter  -n email-dbx  --   mailspring --background
Restart=always
RestartSec=15
TimeoutStopSec=30
Enter fullscreen mode Exit fullscreen mode

Create a Timer

nano ~/.config/systemd/user/mailspring.timer
Enter fullscreen mode Exit fullscreen mode

Inside the timer file:

[Unit]
Description=Start Mailspring service with some delay.

[Timer]
OnStartupSec=40
RandomizedDelaySec=10
Persistent=true

[Install]
WantedBy=timers.target
Enter fullscreen mode Exit fullscreen mode

Then, enable the timer:

systemctl --user daemon-reload && systemctl --user enable mailspring.timer
Enter fullscreen mode Exit fullscreen mode

11. Update the Container Automatically, Zero Maintenance!

This will automatically update all rootless Distrobox containers on your system!

Create a User systemd Service on the Host

nano ~/.config/systemd/user/dbx-upgrade.service
Enter fullscreen mode Exit fullscreen mode

Inside the service file:

[Unit]
Description=Upgrade all Distrobox containers
RequiresMountsFor=/run/user/1000/containers
StartLimitBurst=3
StartLimitIntervalSec=600

[Service]
Type=exec
ExecStart=sh -c "distrobox-upgrade --all"
Restart=on-failure
RestartSec=60
Enter fullscreen mode Exit fullscreen mode

Create a Timer

nano ~/.config/systemd/user/dbx-upgrade.timer
Enter fullscreen mode Exit fullscreen mode

Inside the timer file:

[Unit]
Description=Start Distrobox containers upgrade service with some delay.

[Timer]
OnStartupSec=45
RandomizedDelaySec=15
Persistent=true

[Install]
WantedBy=timers.target
Enter fullscreen mode Exit fullscreen mode

Reload and enable the timer:

systemctl --user daemon-reload && systemctl --user enable dbx-upgrade.timer
Enter fullscreen mode Exit fullscreen mode

Cover Photo by Utsav Srestha on Unsplash

Top comments (0)