Discussion:
Qmail qfilter problem
nitin bhadauria
2010-09-24 07:34:38 UTC
Permalink
Hello List,

I am using qmail vpopmail from a log time now and want to setup a read
tracker to every mails that goes through my qmail server.

So i have setup an php script with mysql database, To use this setup i need
to put a tracker link to every mail that goes through the queue.

So i am using qmail-qfilter jut like we us it in to set disclaimer for
outgoing mail.

Now my problem is that some of mails getting delivered to wrong mail-id.

I have try to unset env variable QMAILRCPTS like this ...

#!/bin/sh
exec /usr/local/bin/qmail-qfilter env -u QMAILNAME -u QMAILRCPTS -u
QMAILUSER -u QMAILHOST /var/qmail2/bin/qmail-read


Which didn't work..


If any did have faced the same problem please shared some thoughts.

Regards,
Nitin B.
Bruce Guenter
2010-09-24 18:37:51 UTC
Permalink
Post by nitin bhadauria
So i am using qmail-qfilter jut like we us it in to set disclaimer for
outgoing mail.
Now my problem is that some of mails getting delivered to wrong mail-id.
What are some examples of the wrong addresses? Is it possible the
filter is sending some output to file descriptor 4, which will become
the new envelope (containing the delivery addresses)?
Post by nitin bhadauria
I have try to unset env variable QMAILRCPTS like this ...
The environment variables will, as you observed, have no effect on this
behavior. Those are only used by qmail-inject. All modifications are
done through files.
--
Bruce Guenter <***@untroubled.org> http://untroubled.org/
Bruce Guenter
2010-09-24 19:09:06 UTC
Permalink
Post by nitin bhadauria
Now my problem is that some of mails getting delivered to wrong mail-id.
#!/bin/sh
exec /usr/local/bin/qmail-qfilter env -u QMAILNAME -u QMAILRCPTS -u
QMAILUSER -u QMAILHOST /var/qmail2/bin/qmail-read
Also, unless it is supposed to be a secret, posting the actual
qmail-read source would be helpful.
--
Bruce Guenter <***@untroubled.org> http://untroubled.org/
nitin bhadauria
2010-09-25 04:27:13 UTC
Permalink
Hi Bruce,

Here is a mail header ..

From: dailyreport <***@example.com>
To: "XYZ" <***@yahoo.co.in>
Subject: Re: EXAMPLE
Date: Fri, 17 Sep 2010 19:00:47 +0530

But the mail get delivery to ***@gmail.com

No it isn't a secret here is the file ..

cat /var/qmail2/bin/qmail-read

#!/bin/bash
ORGUID=`/usr/bin/uuidgen`
INSPECT_DIR=/var/tmp/qmail-qfilter
cd $INSPECT_DIR || { echo Error: $INSPECT_DIR does not exist; exit
$EX_TEMPFAIL; }
cat > $INSPECT_DIR/in.$ORGUID || { echo Error: Cannot write to disk; exit
$EX_TEMPFAIL; }
TEST=$(grep "From: dailyreport" $INSPECT_DIR/in.$ORGUID)
if [ $? -eq 0 ]
then
ORGSUB=`cat /var/tmp/qmail-qfilter/in.$ORGUID |grep "Subject: " |sed
's/Subject: //'g`
ORGTO=`cat /var/tmp/qmail-qfilter/in.$ORGUID |grep "To: " |sed 's/To: //'g`
echo "INSERT INTO readtracking values ('"$ORGUID"', '"$ORGTO"', '"$ORGSUB"',
NOW(), '', '', '', '');"| mysql -u readtrack -preadtrack readtrack
sed -i '/rt.php?uuid/ c\<img
src="http://mail.example.com/rt.php?uuid='"$ORGUID"'"
width="168" height="54" border="0">' /var/tmp/qmail-qfilter/example.html
cat $INSPECT_DIR/in.$ORGUID |sed '/^Content-Type: text/ c\Content-Type:
text\/html;' | /usr/bin/perl -pe 's/Dear Valued Customer,/`cat
example.html`/e' > /tmp/temp123 ; mv -f /tmp/temp123 $INSPECT_DIR/in.$ORGUID
cat $INSPECT_DIR/in.$ORGUID
echo $QMAILRCPTS > /tmp/tests
rm in.$ORGUID
exit $?
else cat $INSPECT_DIR/in.$ORGUID
rm in.$ORGUID
exit $?
fi

Regards,
NItin B.
Post by Bruce Guenter
Post by nitin bhadauria
Now my problem is that some of mails getting delivered to wrong mail-id.
#!/bin/sh
exec /usr/local/bin/qmail-qfilter env -u QMAILNAME -u QMAILRCPTS -u
QMAILUSER -u QMAILHOST /var/qmail2/bin/qmail-read
Also, unless it is supposed to be a secret, posting the actual
qmail-read source would be helpful.
--
Loading...