View previous topic :: View next topic |
Author |
Message |
apokalyptik n00b
Joined: 18 Jun 2002 Posts: 62
|
Posted: Wed Mar 10, 2004 9:30 pm Post subject: add disclaimer or tag line to outgoing e-mail |
|
|
--- Adding the following in for better search results ---
email e-mail vpopmail qmail qmailqueue qfilter perl disclaimer tagline tag line add adding outgoing message mesages smtp altermime domain specific
--- Added the preceeding in for better search results ---
This took me a while to figure out... Thought I would share it
edit 03.10.2004 - updated qmail-disclaimer script... error correction with altermime and non-mime e-mail, and lc() is run on the QMAILHOST variable, so all filenames should be in lowercase only format (so Example.com and example.com both pull from the same disclaimer file)
note: 03.10.2004 -- yes I know most people dont like this idea... oh well... I was paid to develop it, and I've passed it along... dont like it? dont do it :) -- cheers.
Step 1: Install qmail-qfilter (masked as of 03.10.2004)
Code: | cd /usr/portage/net-mail/qmail-qfilter |
Code: | ls -lah
total 24K
drwxr-xr-x 3 root root 4.0K Mar 10 07:49 .
drwxr-xr-x 139 root root 4.0K Mar 9 08:10 ..
-rw-r--r-- 1 root root 467 Aug 7 2003 ChangeLog
-rw-r--r-- 1 root root 189 Aug 7 2003 Manifest
drwxr-xr-x 2 root root 4.0K Jul 31 2003 files
-rw-r--r-- 1 root root 1022 Jul 31 2003 qmail-qfilter-1.5.ebuild |
Code: | emerge ./qmail-qfilter-1.5.ebuild |
Step 2: install altermime
Step 3: Setup qmail-disclaimer
Code: | nano -w /var/qmail/bin/qmail-disclaimer |
Code: | #!/usr/bin/perl -w
use Digest::MD5 qw(md5_hex);
$TEMP_DIR='/tmp/disclaimer/';
$DISCLAIMER_DIR='/var/conf/domains/disclaimers/';
$DISCLAIMER_SUF='.disclaimer.txt';
$ALTERMIME="/usr/bin/altermime";
while ( $input = <> ) {
$CONTENTS.=$input;
}
$DISCLAIMER=$DISCLAIMER_DIR.lc($ENV{"QMAILHOST"}).$DISCLAIMER_SUF;
if ( -e $DISCLAIMER ) {
open (FILE, $DISCLAIMER);
while ( $input = <FILE> ) {
$DISCMSG.=$input;
}
$MD5=md5_hex($CONTENTS);
$TEMP_FILE=$TEMP_DIR.$MD5;
open (OUTPUT, ">$TEMP_FILE");
print OUTPUT $CONTENTS;
close OUTPUT;
if ( -e $ALTERMIME ) {
$SYSCALL="$ALTERMIME --input=$TEMP_FILE --disclaimer=$DISCLAIMER --disclaimer-html=$DISCLAIMER --htmltoo";
system($SYSCALL);
}
open (FILE, $TEMP_FILE);
while ( $input = <FILE> ) {
$NEWCONTENTS.=$input;
}
close FILE;
$TSTSBSTR=index $NEWCONTENTS,$DISCMSG;
if ( $NEWCONTENTS && $TSTSBSTR >= 0 ) {
print $NEWCONTENTS;
} else {
print $CONTENTS."\n\n".$DISCMSG;
}
unlink $TEMP_FILE;
} else {
print $CONTENTS;
} |
Code: | chmod a+rx /var/qmail/bin/qmail-disclaimer |
Code: | mkdir /tmp/disclaimer/
mkdir /var/conf
mkdir /var/conf/domains
mkdir /var/conf/domains/disclaimers |
Step 4: Setup qmail-qfilter-wrapper.sh
Code: | nano -w /var/qmail/bin/qmail-qfilter-wrapper.sh |
Code: | #!/bin/bash
exec /var/qmail/bin/qmail-qfilter \
/var/qmail/bin/qmail-disclaimer |
Code: | chmod a+rx /var/qmail/bin/qmail-qfilter-wrapper.sh |
Step 5: FORCE the qmailqueue to use this for all connections
Code: | nano -w /service/qmail-smtpd/run |
Code: | ......
QMAILQUEUE="/var/qmail/bin/qmail-qfilter-wrapper.sh" export QMAILQUEUE
# Now run it all
exec /usr/bin/softlimit ${SOFTLIMIT_OPTS} \
...... |
Step 6: add a /var/conf/domains/disclaimers/{DOMAIN}.disclaimer.txt file containing the contents of your disclaimer *FOR EACH DOMAIN YOU WISH TO DO THIS TO* _________________ http://www.apokalyptik.com/
Last edited by apokalyptik on Thu Mar 11, 2004 1:11 am; edited 1 time in total |
|
Back to top |
|
|
apokalyptik n00b
Joined: 18 Jun 2002 Posts: 62
|
Posted: Wed Mar 10, 2004 9:30 pm Post subject: |
|
|
Q: cant i put the disclaimer files in /var/vpopmail/domain/*
A: no, qmail-smtpd does not have perms to read that dir. you would first have to chmod o+r that dir, then reconfigure the script to look at something like this:
Code: | $DISCLAIMER_DIR='/var/vpopmail/domains/';
$DISCLAIMER_SUF='/.disclaimer.txt'; |
which should cause $DISCLAIMER to be /var/vpopmail/domains/{DOMAIN}/.disclaimer.txt
this, needless to say, isnt recommended _________________ http://www.apokalyptik.com/ |
|
Back to top |
|
|
berus Guru
Joined: 28 Dec 2003 Posts: 347 Location: Italy
|
Posted: Mon Oct 25, 2004 9:56 am Post subject: |
|
|
Hi!
I want to try your script but the disclaimer messages don't appear in sent mail. I modify the script in this way Code: | $DISCLAIMER_DIR='/var/qmail/control/disclaimers/';
$DISCLAIMER_SUF='.disclaimer.txt'; |
I create a folder disclaimer with my.domain.disclaimer.txt file. For test I chmod 777 discalimers folders and file.
There is a log to understand how it works?
Thanks
edit: it's a problem if in /etc/tcp.smtp there is this line? Code: | 192.9.200.:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"
|
|
|
Back to top |
|
|
berus Guru
Joined: 28 Dec 2003 Posts: 347 Location: Italy
|
Posted: Mon Oct 25, 2004 10:15 am Post subject: |
|
|
I change the line in tcp.smtp (for test only, because I want qmail-scanner and clamav queue.. how? ) end in qmail-smtp log I read Quote: | 2004-10-25 12:04:11.627086500 print() on closed filehandle OUTPUT at /var/qmail/bin/qmail-disclaimer line 21, <FILE> line 3.
2004-10-25 12:04:11.630423500 readline() on closed filehandle FILE at /var/qmail/bin/qmail-disclaimer line 28, <FILE> line 3.
2004-10-25 12:04:11.630552500 Use of uninitialized value in index at /var/qmail/bin/qmail-disclaimer line 32.
|
|
|
Back to top |
|
|
berus Guru
Joined: 28 Dec 2003 Posts: 347 Location: Italy
|
Posted: Mon Oct 25, 2004 10:24 am Post subject: |
|
|
Ok, I make a wrong tmp dir.. now works!
But to use qmail-scanner-queue.pl and your script together?
Thanks |
|
Back to top |
|
|
arunlove007 n00b
Joined: 07 Jun 2008 Posts: 1
|
Posted: Mon Jun 09, 2008 7:33 am Post subject: adding disclaimer |
|
|
I have followed that link and procedure for adding footer to outgoing mails..but it doesn,t work at all.. tried with changing script..and /service/qmail-smtpd/run and /home/vpopmail/etc/tcp.smtp looks like this --
#!/bin/sh
export MFDNSCHECK=""
QMAILQUEUE="/var/qmail/bin/simscan" export QMAILQUEUE
QMAILDUID=`id -u vpopmail`
NOFILESGID=`id -g vpopmail`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
exec /usr/local/bin/softlimit -m 30000000 \
/usr/local/bin/tcpserver -H -R -l 0 \
-x /home/vpopmail/etc/tcp.smtp.cdb -c "$MAXSMTPD" \
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \
/var/qmail/bin/qmail-smtpd mydomain.com \
/home/vpopmail/bin/vchkpw /bin/true 2>&1
and tcp.smtp
127.:allow,RELAYCLIENT="",QMAILQUEUE="/var/qmail/bin/qmail-tail"
10.10..:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-tail"
127.:allow,RELAYCLIENT="",QMAILQUEUE="/var/qmail/bin/simscan"
10.:allow,@special-relay="",QMAILQUEUE="/var/qmail/bin/simscan"
:allow,QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"
I have created qmail-tail script as for disclaimer...
#!/bin/bash
exec /var/qmail/bin/qmail-qfilter
/var/qmail/bin/qmail-disclaimer
I do not understand where iam going wrong is there any change need to be done at qmail scanner side...please help ..i need to setup this... |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|