procmail
[Top] [All Lists]

Re: yet another procmail recipe ID# cd90e6e80610310801h4b0179e7p6a2806b7df582f

2006-11-01 16:22:07
Hi Matt,

Thanks for your response. So from what I understand procmail rule process 
mails in qmail-queue that are detined for local delivery. I would like to 
still have my /etc/tcp.smtp config as below, so that mails are not rejected.

127.:allow,RELAYCLIENT=""
172.26.:allow,RELAYCLIENT=""

But once qmail looks up my rcptphost and see it is not for local mails I 
would like it to drop instead of RELAY

Perhaps another word can I apply procmail rule to qmail-smtp?

Can I do something like this

tcpserver -c100 -x/etc/tcp.smtp.cdb 0 smtp /var/qmail/bin/qmail-smtpd '| 
preline /bin/procmail /etc/procmalrc' /var/qmail/bin/splogger smtpd &

where my /etc/procmailrc list as below

VERBOSE=yes
PATH=/bin:/usr/bin:/opt/bin:/usr/local/bin
LOGABSTRACT=all
COMSAT=no
SHELL=/bin/sh
MAILDIR=$HOME/Maildir/
LOGFILE=/tmp/procmail.log

:0
* !^To:.*(mydomain\.com)
* !^Cc:.*(mydomain\.com)
* !^^X-From: mydomain
{
   LOG = "!mydomain"
   :0
   /dev/null/
}

thanks again in advance,
Kanda

-------------------------------------------------
Message: 1
Date: Tue, 31 Oct 2006 11:01:12 -0500
From: Matt Dunford <zenmatic(_at_)gmail(_dot_)com>
Subject: Re: yet another procmail recipe
To: Kanda Nikornpongsin <thaichili(_at_)hotmail(_dot_)com>
Cc: procmail(_at_)lists(_dot_)rwth-aachen(_dot_)de
Message-ID:
        
<cd90e6e80610310801h4b0179e7p6a2806b7df582f4(_at_)mail(_dot_)gmail(_dot_)com>
Content-Type: text/plain; format=flowed; charset=ISO-8859-1

On 10/30/06, Kanda Nikornpongsin <thaichili(_at_)hotmail(_dot_)com> wrote:
Not sure if this is a qmail or procmail question as I am pretty new to 
both.

I would like to DROP all mails that are NOT sending to "mydomain.com".
Originally our /etc/tcp.smtp on the qmail server was set as a 
"REALYCLIENT"
for a particular internal ip. I remove "RELAYCLINT" part and it is no 
longer
allow any mails relay to this host. But the host that sends out e-mails 
got
a bunch of reject messages. I would like to change the behavior a bit so
that the mails just gets dropped instead of bouncing the messages back?

Hi Kanda,

The best fix for this would be to reconfigure the problem host to use
another relay.  If you don't have access to that server, then you
could block it entirely with a firewall rule.  That would put an end
to any messages on your end and any bounces on theirs.

But if you still want to accept mail from this host, but just drop all
its messages, you'll need to make sure that qmail uses the global
procmail file.  There's a script for this here: /var/qmail/boot/proc.
If that doesn't exist on your system, it's in the source code as
proc.sh.  (Hmmm, I see the latest qmail is 1.03 which came out in 98).

You'll need to copy that script to /var/qmail/rc, I think, and then
restart qmail.  Then you can add all the rules you want to
/etc/procmailrc.  You'll probably want to match the Received: header
and then drop any messages from the problem host.

--
-- Matt Dunford -- zenmatic(_at_)gmail(_dot_)com



------------------------------

Message: 2
Date: Tue, 31 Oct 2006 18:30:04 +0000 (UTC)
From: Jonesy <gmanemp(_at_)jonz(_dot_)net>
Subject: Re: Capturing from address and running a program
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
Message-ID: 
<slrnekf5hc(_dot_)1u61(_dot_)gmanemp(_at_)shell(_dot_)config(_dot_)com>

On Mon, 30 Oct 2006 14:53:14 -0500, Matt Dunford wrote:
On 10/25/06, Poohba <poohba(_at_)blkpoohba(_dot_)dyndns(_dot_)org> wrote:
I need to get the from address and use it in a program.  I have a script
that I want to run depending on the subject.  I am going to send out an
email and the replies will run a program and the program is suppose to
send an email back to them but I need to get the email address to do
this.  Also.  Does procmail allow you to run a command with arguments?
ie:

:0:
* ^Subject.*this is a test for this program
|/path/to/this/program/for senders_email_address

So how do I get the email address and would that work?  The program will
take that argument and plug it in as the recipient.

Try something like this (not 100% sure on the regex):

:0:
* ^From:.*\/[0-9a-z(_dot_)_-]+(_at_)[0-9a-z(_dot_)_-]+\(_dot_)[a-z]+
* ^Subject.*this is a test for this program
|/path/to/this/program/for "$MATCH"

You can use formail to give you the email addy that a "Reply" would be
sent to:
          formail -rtzxTo:

I use this approach to compare the 'From' of an email to my whitelist:
  :
  |WHITE = "No"
  |:0
  | * ? formail -rtzxTo: | fgrep -i -f $PMDIR/whitelist
  | {
  |  WHITE = "Yes"
  | }
  :

HTH
Jonesy
--
   Marvin L Jones    | jonz          | W3DHJ  | linux
    38.24N  104.55W  |  @ config.com | Jonesy |  OS/2
     *** Killfiling google posts: <http//jonz.net/ng.htm>




------------------------------

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail


End of procmail Digest, Vol 46, Issue 1
***************************************



____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>