Second Instance of Qmail for Disclaimer: Difference between revisions
No edit summary |
No edit summary |
||
| Line 180: | Line 180: | ||
#!/bin/sh | #!/bin/sh | ||
INSPECT_DIR=/var/tmp/qmail-qfilter | INSPECT_DIR=/var/tmp/qmail-qfilter | ||
if [ ! -f /var/qmail2/control/disclaimer/$QMAILHOST.txt ] | if [ ! -f /var/qmail2/control/disclaimer/$QMAILHOST.txt ] | ||
| Line 215: | Line 214: | ||
<nowiki>#!/bin/sh</nowiki> | <nowiki>#!/bin/sh</nowiki> | ||
QMAILQUEUE="/var/qmail2/bin/qmail-tail" export QMAILQUEUE | QMAILQUEUE="/var/qmail2/bin/qmail-tail"; export QMAILQUEUE | ||
Also Make sure the Qmail-smtpd is running on port 900 by | Also Make sure the Qmail-smtpd is running on port 900 by | ||
| Line 239: | Line 238: | ||
# telnet and send mail via Qmail-2 , you should get the disclaimer | # telnet and send mail via Qmail-2 , you should get the disclaimer | ||
# Test via offline Client like Evolution , Outlook etc . You should get the mail with disclaimer attached . | # Test via offline Client like Evolution , Outlook etc . You should get the mail with disclaimer attached . | ||
== Troubleshooting == | |||
1. QQ error while sending mails | |||
Check the smtp logs , if find error like | |||
''/usr/local/bin/qmail-qfilter: error while loading shared libraries: libbg-sysdeps.so.1: cannot open shared object file: No such file or directory'' | |||
Then | |||
you have to link libbg-sysdeps.so.1 to /usr/lib | |||
ln -s /usr/local/bglibs/lib/libbg-sysdeps.so.1 /usr/lib/ | |||
This should solve the issue | |||
Revision as of 17:48, 19 January 2013
This document is part of Hindustan times implementation document talking about Qmail Disclaimer Integration with QMAIL Second Instance
Concept
Disclaimer on Qmail is Added to the Second Instance so that only Out going mails to different domains are uploaded with Common Signature / Disclaimer. This can be done for multiple domains too.
Implementation process
- Implement Qmail-2 , i.e Second Qmail Instance
- Define Qmail-send and Qmail-smtpd daemons
- Define 2nd Qmail smtp port ( say 900)
- Install Qmail-qfilter , altermime and bglibs to satisfy the requirement.
- Define Multiple domain's text and HTML disclaimer
- Integrate Qmail's both the instances
Second Instance of Qmail for Disclaimer
mkdir -p /var/qmail2
mkdir /usr/src/qmail2
cd /usr/src/qmail2
tar xvzf /downloads/qmailrocks/qmail-1.03.tar.gz
cd qmail-1.03
patch -p1 < /downloads/qmailrocks/patches/qmail-1.03.errno.patch
patch -p1 < /downloads/qmailrocks/patches/qmailqueue.patch
echo 255 > /usr/src/second-qmail/qmail-1.03/conf-spwan
echo 211 > /usr/src/second-qmail/qmail-1.03/conf-split
vi conf-qmail
( replace qmail with qmail2 )
And then make setup check
Disclaimer Related Implementation
cd /downloads/
rpm –Uvh bglibs-1.022-1.i386.rpm ( get it from http://untroubled.org/bglibs/ )
tar xvzf altermime-0.3.6.tar.gz (get it from http://www.pldaniels.com/altermime/ )
cd altermime-0.3.6makemake install
tar xvzf qmail-qfilter-2.1.tar.gz (http://untroubled.org/qmail-qfilter/)
cd qmail-qfilter-2.1
vi qmail-qfilter.c
( change qmail into qmail2 )
------------------------------------------------------------------------------------------------------
#ifndef QMAIL_QUEUE
#define QMAIL_QUEUE "/var/qmail2/bin/qmail-queue"
#endif
------------------------------------------------------------------------------------------------------
make
make install
chmod 777 /usr/local/bin/qmail-qfilter
chown root:qmail /usr/local/bin/qmail-qfilter
vi /var/qmail2/bin/qmail-tail
#!/bin/sh exec /usr/local/bin/qmail-qfilter /var/qmail2/bin/qmail-disclaimer
chown root:qmail /var/qmail2/bin/qmail-tail
chmod 777 /var/qmail2/bin/qmail-tail
mkdir /var/qmail2/control/disclaimer/
cd /var/qmail2/control/disclaimer
vi hindustantimes.com.html
-----------------------------------------------------------------------------------------------------
<html>
<body>
IMPORTANT NOTICE:
"This email is confidential containing HT Media confidential information, may be
legally privileged, and is for the intended recipient only. Access, disclosure,
copying, distribution, or reliance on any of it by anyone else is prohibited and may
be a criminal offence. Please delete if obtained in error and email confirmation to
the sender."
Experience news. Like never before. Only on www.hindustantimes.com
</body>
</html>
-------------------------------------------------------------------------------------------------------
vi hindustantimes.com.txt
-------------------------------------------------------------------------------------------------------
IMPORTANT NOTICE:
"This email is confidential containing HT Media confidential information, may be
legally privileged, and is for the intended recipient only. Access, disclosure,
copying, distribution, or reliance on any of it by anyone else is prohibited and may
be a criminal offence. Please delete if obtained in error and email confirmation to
the sender."
Experience news. Like never before. Only on www.hindustantimes.com
------------------------------------------------------------------------------------------------------
chown root:qmail /var/qmail2/control/disclaimer/*
chmod 777 /var/qmail2/control/disclaimer/*
mkdir /var/tmp/qmail-qfilter
chown root:qmail /var/tmp/qmail-qfilter
chmod 777 /var/tmp/qmail-qfilter
vi /var/qmail2/bin/qmail-disclaimer
#!/bin/sh
INSPECT_DIR=/var/tmp/qmail-qfilter
if [ ! -f /var/qmail2/control/disclaimer/$QMAILHOST.txt ]
then
cat
exit 0
fi
EX_TEMPFAIL=31
EX_UNAVAILABLE=31
trap "rm -f /var/tmp/qmail-qfilter/in.$$" 0 1 2 3 15
cd $INSPECT_DIR || { echo Error: $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; }
cat >$INSPECT_DIR/in.$$ || { echo Error: Cannot write to disk; exit $EX_TEMPFAIL; }
/usr/local/bin/altermime --input=$INSPECT_DIR/in.$$ \
--xheader="X-Disclaimer: $QMAILHOST" \
--disclaimer=/var/qmail2/control/disclaimer/$QMAILHOST.txt \
--disclaimer-html=/var/qmail2/control/disclaimer/$QMAILHOST.html || { echo Error: message rejected; exit $EX_UNAVAILABLE; }
cat $INSPECT_DIR/in.$$
rm in.$$
exit $?
chown root:qmail /var/qmail2/bin/qmail-disclaimer
chmod 777 /var/qmail2/bin/qmail-disclaimer
Activation of Qmail2
Changes on Qmail2-Send run file
vi /service/qmail2-smtpd/run
( add following line at the top )
#!/bin/sh QMAILQUEUE="/var/qmail2/bin/qmail-tail"; export QMAILQUEUE
Also Make sure the Qmail-smtpd is running on port 900 by
vi /etc/services
# Local services second-qmail 900/tcp
Integrate Qmail with Qmail2
vi /var/qmail/control/smtproutes
:127.0.0.1:900
Note: Then restart the qmail from /etc/inittab file.
Testing
- telnet and send mail via Qmail-2 , you should get the disclaimer
- Test via offline Client like Evolution , Outlook etc . You should get the mail with disclaimer attached .
Troubleshooting
1. QQ error while sending mails
Check the smtp logs , if find error like
/usr/local/bin/qmail-qfilter: error while loading shared libraries: libbg-sysdeps.so.1: cannot open shared object file: No such file or directory
Then
you have to link libbg-sysdeps.so.1 to /usr/lib
ln -s /usr/local/bglibs/lib/libbg-sysdeps.so.1 /usr/lib/
This should solve the issue