Reminders and appointments
Syncing Google Calendar with Evolution is straightforward thanks to its native support. Navigate to the Calendar section and select the Calendar option when you click the down arrow next to New.
In the window that appears you’ll see a drop-down menu for Type. Simply select Google and provide the relevant information. Bear in mind that if you’re using two-factor authentication then you’ll need to generate an application password.
For other webmail services you can point to your private iCAL link with the WebDAV option. You could also download an ICS file and import it into your local calendar, but changes won’t automatically sync back to the server.
Unfortunately, Thunderbird is less straightforward; support for calendars at the time of writing could charitably be called experimental! You’ll need to install an add-on called Lightning, which you can obtain by heading to Tools>Add-ons>Get Add-ons. In addition, you’ll need to find ‘Browse all add-ons’ and search for the plugin before you can install it.
Lightning only creates local calendars, so to sync with Google Calendar you need install a provider add-on too. Unfortunately, at the moment this is only compatible with Thunderbird if it’s the 32-bit incarnation and version 52.0 or earlier. But there’s a positive end in sight, thankfully: there have been significant governance changes for Thunderbird as a project and so we eagerly anticipate a fix.
MozillaThunderbird also has a similar filtering facility. Head to Tools>Message Filters. When you add one with the New button you’ll find extra section determining when you filter should run. By default this is whenever mail is received, but you can change it to run the rule whenever you’re sending or archiving email if this seems more appropriate for your filter rule. The remaining parts are similar to Evolution. You can define what your filtering conditions are and in what order, then state the actions that should apply to that filter.
In both cases you should start to see your rules apply to new incoming mail. If you’d like to check the way you’ve been creating filters works, then create a test filter that redirects email sent from yourself to a particular folder, then send an email to yourself to verify that the message appears where you expected it to. If it still appears in your inbox you should check that you have filters rules enabled for incoming mail and that your filter condition can catch it.
Dropping the GUI
Now you know the basics of how to set up a mail client, we could take things a step further by syncing all the emails on our webmail server locally. You may be wondering why you’d do this, because it sounds like something Evolution and Thunderbird ought to be doing already.
The key reason is it’s a fantastic tool for backing up your emails in case someone hijacks your account or you delete a message accidentally. Normal mail clients will quite happily delete your local copy of an email as soon as it connects to the mail server, which in the wrong situation can be bad news. Those on slower or metered connections might also find it quicker and cheaper to simply download messages onto one device and then sync them across the local network.
Of course, it could also be that you’re a hair shirt enthusiast who wants to build and try out an email client setup that even Richard Stallman himself would be proud of if you weren’t using a webmail provider he dislikes. (There’s no judgement from us, we think it’s pretty cool too!)
Offline IMAP
The first step is to download the offlineimap package from your distribution’s repositories. Once it’s installed, you’ll need to create an .offlineimaprc file in your home directory. To do this, open it in your favourite text editor and then add the following lines to the file:
[general] ui = ttyui accounts = Webmail
[Account Webmail] localrepository = Webmail-Local remoterepository = Webmail-Remote
This defines what your account will be called from offlineimap’s point of view. The names that you decide on for the local and remote repositories are aliases for settings further down the file, where the former defines the settings for the offline mail that you plan to host inside your home directory and the latter fetches messages from the webmail provider.
The local configuration method that you need to follow is relatively straightforward: [Repository Webmail-Local] type = Maildir localfolders = ~/Mail/Webmail
The next part of the process is a little more complex, because you’ll need to ensure that the IMAP server, port and authentication settings match those provided by your webmail host. Again, if you use two-factor authentication to safeguard your account then you’ll need to generate an application password for this step. You can achieve this by typing the following: [Repository Webmail-Remote] type = IMAP remotehost = imap.server.address remoteport = 993 remoteuser = user@email.com remotepass = applicationpassword realdelete = no maxconnections = 3 sslcacertfile = /etc/ssl/certs/ca-certificates.crt
For safety’s sake it makes sense to set realdelete to no, so that you always have a recoverable version of the message stored. Finally, you can test your saved offlineimap configuring by loading up bash and trying it out with some log output. $ offlineimap -o
Bear in mind that offlineimap won’t update itself automatically. You’ll need to setup a cron job to reload the email list periodically. You can open up your configuration
with crontab -e and then simply add the following line to your configuration: @hourly offlineimap
Sending mail
While for web applications and log alarms you might be tempted to use a tool like sendmail, for personal messages you should make use of the SMTP server that your webmail host provides so the origin of the message can be verified. This can be achieved with the help of msmtp. After installing it through your package repositories as before, you’ll need to create an .msmtprc file and then add the following lines to it: account default host smtp.server.com port 587 protocol smtp auth on from user@email.com user user@email.com password applicationpassword tls on tls_nocertcheck
You’ll need to change the settings according to those provided on your webmail host’s help pages. You can test your configuration is correct by setting permissions and then creating a test email: $ chmod 600 .msmtprc $ echo a test message | msmtp test@email.com
If you were successful, you should see an email message in your webmail account’s sent folder. Don’t panic if it’s blank as it should still work with Mutt in the next section.
Release the hounds
Now that you have a working offlineimap setup pulling files down to a known location, it makes sense to open them up and check that they’re still readable. This is where Mutt comes in, because this will provide us with a command line email client that can connect to our downloaded messages. Once you’ve installed the package you should create a . muttrc file in your home directory and then add the following lines: set sendmail=/usr/bin/msmtp set use_from=yes set realname=John Smith set from=user@email.com set envelope_from=yes
This tells mutt to use msmtp to send emails and the default sender information it should provide. We can test this out by launching mutt at the command line. When the tool appears hit M to start a new mail and send it to yourself. While composing the message, Mutt will launch Nano when you reach the message section. You’re not restricted to that choice though, and could switch it to gedit, Emacs or Vim by adding a line to your mutt configuration file similar to this one: set editor=vim
Then hit Y to send. If you check your webmail account through a browser you should spot the test emails in your sent folder and inbox, assuming everything went well.
Now we can send email in Mutt, it makes sense to start reading the email stored in from offlineimap. To do that we are going to have to add some more lines to our .muttrc:
set mbox_type = Maildir set folder= ~/Mail/Webmail set spoolfile = +Inbox set mbox= +Archive set postponed = +Drafts unset record mailboxes +INBOX
The + symbols ensure the prefix we set for the folder setting is added to the folder path. We unset Mutt’s recording as your webmail will keep copies of sent emails. On the last line we list the folders we want to fetch messages from and display. To add more, append them to the end of that line.