Configuring sendmail to forward through Gmail

posted on Sep 5, 2016

These days we get Gmail to manage mail servers (in my case this happened due to the large amount of spam filtering that my email server had to do). However many Linux services may need to send email and yet I don't usually check the local email accounts on each machine. The best way to have those automated emails to work is to have the machine forward email through Gmail. This post describes how I set this up on Slackware 14.2.

Step 1 create Gmail authentication file

  1. mkdir -m 700 /etc/mail/authinfo/
  2. cd /etc/mail/authinfo/
  3. create new file gmail-auth with the following content:
    AuthInfo: "U:root" "" "P:password"
  4. chmod 600 gmail-auth
    (because it has your password!)
  5. makemap hash gmail-auth < gmail-auth

Step 2 configure sendmail

In Slackware 14.2 the sendmail configuration files are kept in /usr/share/sendmail/cf/cf/. We will create a new configuration file by expanding the base slackware sendmail configuration. This will have to be compiled and deployed in /etc/mail, then sendmail needs to be restarted to reload the new configuration (or as in my case, activated for the first time).

  1. cd /usr/share/sendmail/cf/cf
  2. cp
    (but you can use a different base configuration in that folder if it is more appropriate)
  3. edit to include the following code instead of the line dnl define(`SMART_HOST',`'):
    define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
    define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
    define(`confAUTH_OPTIONS', `A p')dnl
    FEATURE(`authinfo',`hash -o /etc/mail/authinfo/gmail-auth.db')dnl
  4. Now we compile the configuration and put it in /etc/mail:
    m4 > /etc/mail/

Step 3 enable or restart sendmail

If you already have sendmail running, you need to restart it, otherwise you need to enable it and start it (my case):

  1. cd /etc/rc.d
  2. chmod a+x rc.sendmail
  3. ./rc.sendmail start

Step 4 enable Gmail to accept messages

In older days the above would be enough, but these days Gmail does not want to accept other applications connecting other than Google apps themselves. So we have to setup the Gmail account to allow "unsecure" connections. (These may be indeed less secure, but note that the configuration above is using TLS to encrypt the connection.)

  1. Login to your Gmail account at
  2. On the account homepage, click Sign-in & security (or navigate to
  3. Turn on Allow less secure apps
  4. Go to the page and press Continue
  5. Now, back on the command line on your server send a message like this:
    echo "Testing mail forwarding through Gmail" | mail -s "Forward test" someother@email.address
    (we're sending to a different email address so that we can check how all forwarded messages arrive; essentially they come from your (added in step 1.3). Note that all accounts on your machine now forward email through this!)

Your test message should have arrived at your test email account. It seems that if the machine forwarding mail to Gmail does not have a reverse DNS entry, the messages may take quite some time to be processed (Gmail slowing down machines that may be suspect of sending spam, as these days most bona fide mail servers would have a reverse DNS entry).

Slackware on a Lenovo ThinkPad X220t

posted on Feb 18, 2012

This is about setting up Slackware Linux on the "Convertible" Laptop-Tablet PC Lenovo X220t. This combines the advantages of a tablet (being able to write with a pen) with the speed of a proper computer (an i5 rather than an ARM processor). I use it both for running lengthy simulations, as well as for editing PDFs with handwriting.

Slackware64 13.37

  • installed the full package, using a USB install as this machine has no optical drive (an option that I did not get). The install went smoothly and it recognized most of the hardware
  • applied all the patches available at the time
  • applied two packages from testing: libdrm-2.4.25 and mesa-7.10.2

Kernel 3.2.6

The kernel that comes in 13.37 has old wacom drivers that don't work with the touch screen of the X220t (which is a USB device). So I upgraded the kernel to 3.2.6.

  • I use this config file.
  • added the kernel parameter i915.semaphores=1 so as to not hang the video, a problem that has pestered all Intel SandyBridge chips. (You add this in /etc/lilo.conf to the append section)
  • added the latest microcode for the Centrino-N 1000 wireless adapter to /lib/firmware (the file iwlwifi-1000-5.ucode in the tarball)

The X11 system in 13.37 comes with an xf86-driver-wacom package that does not support the X220t touchscreen very well. A more recent version is needed to make the table work fine. I've created a package for version 12.0 using the build scripts included in 13.37. Building parts of X11 are not as straightforward as building simpler packages, so I am providing here the package that I build, feel free to download: xf86-input-wacom-0.12.0-x86_64-2.txz

Usability chart

ethernetintegrated Intel 82579LM Gigabitworkse1000e
wifiintegrated Intel Wireless-N 1000 BGNworksiwlwifinot tried N mode
videointegrated Intel SandyBridgeworksi915requires i915.semaphores=1 kernel parameter or else there are frequent GPU hangs
sound cardintegrated Intel HDAworkssnd-hda-intelintegrated microphone works; external mic and heaphones requires single jack and not yet tested
cameraChicony Electronics 04f2:b217worksuvcvideoworks up to 1280x720
hotkeyskeyboardpartialthinkpad_acpivolume and brightness work, suspend and others don't
BluetoothBroadcom 0a5c:217f untestedbluetoothled is up, appears to work but need to test
fingerprint readerUpek 147e:2016does not work apparently can work but needs a driver and software
flash card readerRicoh device e823workssdhci-pcionly tested SD and SDHC cards

On moving from KDE to XFCE

posted on Feb 07, 2012

KDE has been my window manager for ages, but I am getting tired of how it has become slow and wasteful. By and large the KDE applications are fine, but the increasing dependency of the system on its semantic desktop is not. (You may think that a semantic desktop would be a nice feature, and in theory it is, but in practice it consumes large amounts of resources for no visible advantage).

So I am trying out XFCE, a GTK-based window manager that is very slim and sleek (ie nothing like Gnome!). I am not really worried about the disk space that the KDE applications take, so I am happy to leave them on the disk and maybe even use them (as long as they don't require running akonadi or nepomukserver).

This blog post is really meant to be a list of applications that I will use in XFCE instead of the ones I use in KDE. It is an evolving post: I will come back and edit whenever I find better options. If you are interested, do come back to check.

In case you don't follow my blog, I should say that I use Slackware, either 32-bit or 64-bit (pure, I don't like 32-bit compatibility libraries!).

KDE applicationSubstituteComments
KMailThunderbirdI've already done this switch and use it in KDE. It is not better than KMail; I particularly dislike that it uses mbox files rather than Maildir, but I've overcome this by running my own IMAP server (dovecot)
KonquerorFirefoxnothing to be said here, firefox is the leader, otherwise it would be Chrome
Katemedit medit can have several files open, does syntax coloring and can open terminal window - all the features that I use in kate
Amarok VLC not as good as amarok, will try other options too: xmms, audacious, aqualung, exaile
Okular ? candidates:evince, epdfview, acroread (only 32-bit)
Digikam ? This is a toughie, I use Digikam for my large photo database and really haven't found anything equivalent (apart from KPhotoAlbum, but that is also a KDE app) This will be a showstopper, at least on my home PC
KdenliveOpenShot Kdenlive does not use akonadi, only kdeinit4, klauncher and kded4 (the basic processes of KDE), so I consider it usable for my purposes. The alternative, OpenShot is a python program and does seem suitable (not as much features as kdenlive but close)
KSnapshot xfce-screenshooter-plugin Gimp also does the job well
Konsole Terminal defaut XFCE application; works well, especially after setting all properties (window height had to be done on ~/.config/Terminal/terminalrc)
dolphinthunarthis is the default on XFCE, seems ok. Alternatives could be XFE or PCManFM
gwenviewgeeqieworks fine
K3b ?xfburn, Xcdroast?
KCalcgalculator GTK2-based calculator, has scientific and hex modes.
kdesu? ktsuss, gtksu
KHexEditor?GHex, JHEditor?

I already use several applications that are not KDE-specific and these don't have to change: OpenOffice/LibreOffice, Inkscape, Calibre, Sigil, Skype, Hugin, Pidgin, Audacity, XVidCap, Xournal, Eclipse.

Switching from KMail to Thunderbird

posted on Nov 20, 2011

KMail needs to go...

I have been very conservative with my email software. One of the reasons is that I have a massive mail folder and keep eons of email (ie 1994 onwards). There are large numbers of folders and some folders contain tens of thousands of messages... In this scenario you don't move to new software very frequently. I started off with MH (command line on Unix), then briefly with Eudora (Windows 3.1), but stabilized to Pegasus Mail while I used Windows. When I took the plunge and got rid of Windows entirely, in 2003, I started using KMail, the KDE mail client.

KMail was faithful for a long time but now that the KDE folks are messing around with Akonadi et al. I've started having lots of problems with KMail. I finally decided I need to move on, and after a bit of searching on the web (mainly the Slackware forum on LinuxAnswers), I finally decided to go with Mozilla Thunderbird.


My configuration requirements are the following:

  • I run Slackware on all my computers (most are on 13.37, some still on 13.1)
  • I connect to two different work accounts (ie two entirely different sets of SMTP/IMAP servers)
  • I like to copy everything to my local store, because I need to access all my email when I am offline. (I don't trust the cloud that much...)
  • I like to leave a few months of email on the IMAP server so that I can access them through webmail if needed
  • I synchronize my home folder between several computers and portable drives; essentially there are 4 live copies (can all be used at any time) and a couple of portable drives. Everything is synchronized using unison.
  • I want to be able to have the same Thunderbird local folders on various (synced) computers but each one should have their own profiles (because of font sizes, etc.)
  • I don't really want to copy around (sync) the cached IMAP messages (because they are on IMAP server anyway and it is a bit of volume: approximately 5000 messages)

Setting up Mozilla Thunderbird

The first thing I did was setup thunderbird on one of the computers. Fortunately thunderbird is already part of Slackware so no need to install any packages. The other steps were:

  1. I configure my IMAP and SMTP work accounts, then close Thunderbird.
  2. I copied the contents of the local mail store to ~/Mail using the information on mozillazine (essentially move the folder "Mail/Local Folders" to ~/Mail and change Thunderbird to recognize this)
  3. At this stage I have the basic configuration, where the profile is under ~/.thunderbird (which is not synced) and the local mail is in ~/Mail (which is synced).
  4. I repeat the configuration of Thunderbird on the other computers and there also change the Local Folders to point to ~/Mail (beware that on those there is nothing to copy, just change the location)

Migrating the folders from KMail into Thunderbird local folders

I use the python script posted by Jakob Schiøtz to import the KMail folders into the new Thunderbird local folders. I piped the output of the script to a text file and then carefully went over this to make sure that there were no errors... After running the script I started Thunderbird to check that my gigantic email tree is all there. At this stage it is useful to click on every folder, so that Thunderbird can create an index for each folder.

There is also a different script to do this job but it did not work well for me.

Making IMAP work like POP3

I like to use the IMAP server only as a temporary store of my recent messages, a bit like I used to work with a POP3 server. Essentially I want all new messages to be copied to the local folder. They should show as new in the local inbox and as read in the IMAP server. However I want to copy all new messages, not just the unread ones (because I may have read the message over webmail, I still want it copied to local). This was a lot harder to configure on Thunderbird than I ever expected (not that it was too easy with KMail either...). This is how it works:

  • Create a filter on the IMAP inbox to copy messages to local inbox. Name it "IMAP to Local" and make it run when checking email (this is important). Search criterion is "Tags doesn't contain Local", the actions are "Tag Message Local" and "Copy Message To Inbox on Local Folders". This filter will copy messages to the local inbox as they arrive, but leaves them marked as unread on both inboxes (IMAP and local)
  • Create a filter on the IMAP inbox to copy messages to local inbox. Name it "Mark Copied as Read" and make it run when checking email (after classification) (this is important). Search criterion is "Tags contains Local" AND "Status isn't Read", the action is "Mark as Read". This filter will then mark the messages that have already been copied to local as read, but only in the IMAP inbox (ie they stay marked unread in the local inbox)


This blog is an assorted collection of geeky thoughts, mostly stuff I want to remember about coding, configuring Linux and Slackware.

Creative Commons License

My twitter feed

My Flickr stream