Home Download FAQ / Knowledge Base Screenshots Documentation Support

Does Citadel have a /usr/sbin/sendmail replacement, so that I can send mail out from shell scripts?


When using Easy Install

All you really need to do is replace your existing /usr/sbin/sendmail with a symbolic link to /usr/local/citadel/citmail . see detailed description below.

When using the Debian packages

This will replace your existing MTA (exim, postfix... ) with citadel, Run

  apt-get install citadel-mta

and your'e done.

When using 'alternatives'

If you are using Linux and have support for /etc/alternatives you may wish to install /usr/local/citadel/citmail as a "sendmail alternative". Here is an example of how to do this:

  /usr/sbin/alternatives --install /usr/sbin/sendmail mta /usr/local/citadel/citmail 30 \
    --slave /usr/lib/sendmail mta-sendmail /usr/local/citadel/citmail
  /usr/sbin/alternatives --config mta

(and select Citadel from the menu)

Or the brute force method...

This way is the reliable way to do it everywhere:

  cd /usr/local/citadel 
  cd /usr/sbin 
  mv sendmail sendmail.OLD 
  ln -s /usr/local/citadel/citmail ./sendmail 

That's all there is to it! All mail sent by shell scripts will now be deposited into the Citadel mail spool and delivered as usual.

Sample shell script using citmail

For testing or for new scripts, just put in the right path and recipient, and this shellscript will create a valid mail for you:



From: testuser@somewhere.org
Subject: testmail

some test text.


There also is a more versatile third party tool available to deliver simple outbound email from scripts. It is called MSMTP. Here's a sample configuration file showing how to use it with Citadel:

account default
host yourcitadel.org
auto_from on
maildomain somehost@yourcitadel.org
domain yourcitadel.org
auth plain
user sender
password OpenSesame

If you need encryption, you can also make it use TLS.


A very generic name, but possibly a viable alternative for MSMTP also able to 'compose' messages out of parts: Email. There also is a nice LXR article on using Email.

Generating test messages

For testing your local Citadel, or other mail servers in general, you can use NetCat in this tiny shell script to send you a facsimile of an email you previously saved from Thunderbird using Ctrl-U:

echo ehlo yourcitadel.org
sleep 1
echo MAIL FROM: somebody@yourcitadel.org
sleep 1
echo RCPT TO: testuser@yourcitadel.org
sleep 1
echo DATA
sleep 1
cat $1
sleep 1
echo .
sleep 1
echo quit
) | nc 25

Edit to your needs, change yourcitadel.org to your hostname and testuser@yourcitadel.org to the recipient that should receive the test message. Then call it like this:

./send_test_mail.sh mailtemplate_from_thunderbird.txt

You now will find that message in the inbox of testuser@yourcitadel.org.

There are no social media links here. Enjoy a friendly Citadel community instead. Or go outside.