Home Download News FAQ / Knowledge Base Screenshots Documentation Support Site map
philosophical imaginary
Table of Contents

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

Yes.(Unsure which of the folloing you're running? seeHowto determine between the both)

  apt-get install citadel-mta

and your'e done.

Easy Install

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)

do it on any system

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 shellscript using citmail

Just put in the right path and recipient, and this shellscript will create a valid mail for you:

#!/bin/bash
 
CITMAIL=/usr/sbin/citmail
RECIPIENT=testrecipient@somecitadelserver.org
 
cat <<EOF | $CITMAIL -t ${RECIPIENT}
From: testuser@somewhere.org
To: ${RECIPIENT}
Subject: testmail
 
some test text.
EOF

Using MSMTP

There also is a more versatile 3rd party tool around with more features etc.; its MSMTP. Here's a sample configuration file 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

In doubt, you can also make it use TLS.

Email

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 Testmessages

For testing your local citadel or other mailservers in general you can use NetCat in this tiny shellscript to send you a faximile of an email you previously saved from Thunderbird using CTRL + u:

#!/bin/bash
(
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 127.0.0.1 25

edit to your needs, change yourcitadel.org to your hostname and testuser@yourcitadel.org to the recipient that should receive the testmessage.

Call it like that:

./send_test_mail.sh mailtemplate_from_thunderbird.txt

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

Copyright © 1987-2014 Uncensored Communications Group. All rights reserved.     Login (site admin)