ssmtp: making it the alternative to sendmail under Fedora 2


I use ssmtp for my MTA (mail transfer agent) under fedora.  Up till now I've always just moved /usr/sbin/sendmail out of the way and symlinked it to where I have ssmtp installed.  Today, after upgrading a work machine to f14, I finally bit the bullet and figured out how to set ssmtp as my MTA the proper way – through the alternatives command.

Sendmail is configured as the mta under alternatives.  You can see which mta's are available by doing this:

alternatives --config mta

which shows something like this:

There is 1 program that provides 'mta'.

 Selection    Command 
 -----------------------------------------------
 *+ 1           /usr/sbin/sendmail.sendmail

To add ssmtp, I must first install it as an alternative mta:

sudo alternatives --install /usr/sbin/sendmail mta /usr/local/ssmtp/sbin/ssmtp 20000

This says that /usr/local/ssmtp/bin/ssmtp is an alternative option for /usr/sbin/sendmail under the alternatives label of mta.  The 20000 is large enough to make this particular alternative the default, though it can be changed later.

Now we can see the new configuration:

There are 2 programs which provide 'mta'.

 Selection    Command
-----------------------------------------------
 1           /usr/sbin/sendmail.sendmail
*+ 2           /usr/local/ssmtp/sbin/ssmtp

The new entry is now the default.  You can use the alternatives command to change it back later if you need to.  The nice thing about using alternatives was that I didn't need to change the /usr/sbin/sendmail link at all.  Alternatives takes care of that for you.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 thoughts on “ssmtp: making it the alternative to sendmail under Fedora

  • Sean Reifschneider

    Why not just “yum install ssmtp; yum remove sendmail”? It looks like Fedora has included it since F11, and it correctly sets up the alternatives. From the spec file:

    %{_sbindir}/alternatives –install %{_sbindir}/sendmail mta %{_sbindir}/sendmail.ssmtp 30 \
    –slave %{_bindir}/mailq mta-mailq %{_bindir}/mailq.ssmtp \
    –slave %{_bindir}/newaliases mta-newaliases %{_bindir}/newaliases.ssmtp \
    –slave %{_mandir}/man1/mailq.1.gz mta-mailqman %{_mandir}/man1/mailq.ssmtp.1.gz \
    –slave %{_mandir}/man1/newaliases.1.gz mta-newaliasesman %{_mandir}/man1/newaliases.ssmtp.1.gz \
    –slave %{_mandir}/man8/sendmail.8.gz mta-sendmailman %{_mandir}/man8/ssmtp.8.gz

  • mjhammel Post author

    Oh sure, do it the easy way. :-)

    Actually long ago when I started using ssmtp (see Linux.com article) I thought the project was basically abandoned so no one would package it. I just never checked since then. It’s nice to see it got picked up. It’s a nice replacement for sendmail.

    Thanks for pointing that out.