procmail forwarding duplicates mails
procmail forwarding duplicates mails
am 02.08.2006 20:08:03 von Marko Faldix
Hello,
there is a very nice example how to forward mails to external adresses
there: http://pm-doc.sourceforge.net/pm-tips.html
13.11 Service: forward only specific messages
# By Jim Hribnak
# info@1.example.com goes to joe@1.example.com
# info@2.example.com foes to fred@2.example.com
:0
* ^TO_()info@1.example.com\>
{
FORWARDTO = "$FORWARDTO joe@1.example.com"
}
:0
* ^TO_()info@2.example.com\>
{
FORWARDTO = "$FORWARDTO fred@2.example.com"
}
:0 fhw
* FORWARDTO ?? @
* ! ^$MYXLOOP
| $FORMAIL -A "$MYXLOOP"
:0 a
! $FORWARDTO
My question is:
Now if send an email addressed to both info@1.example.com and
info@2.example.com then each of them will get it twice. In my configuration
I switched both adresses in example.com's virtusertable to the linux user
in whose account I can let process procmail so that I can do other
additional things which procmail can. So I sent one mail but procmail got
it twice to process for each of the adresses. How can I determine for which
adress procmail is processing?
Thanks for ideas.
Re: procmail forwarding duplicates mails
am 02.08.2006 21:12:31 von Garen Erdoisa
Marko Faldix wrote:
> Hello,
> [snip]
>
> My question is:
> Now if send an email addressed to both info@1.example.com and
> info@2.example.com then each of them will get it twice.
As a guess:
This strikes me as a case where you might have an email alias set up in
sendmail "/etc/aliases" that is expanding to multiple recipients. If you
are running your recipe out of "/etc/procmailrc" then each instance of
the expansion would have sendmail calling /etc/procmailrc which
depending on the interaction between sendmail and procmail can result in
multiple copies of the same message delivered to an inbox.
To be sure about this, more information is needed about your particular
setup.
I've been able to duplicate this scenario under other circumstances in
the past.
> In my configuration
> I switched both adresses in example.com's virtusertable to the linux user
> in whose account I can let process procmail so that I can do other
> additional things which procmail can. So I sent one mail but procmail got
> it twice to process for each of the adresses. How can I determine for which
> adress procmail is processing?
Suggestion: Add the following to your procmail recipe to dump the
following procmail variables:
NL="
"
LOG="[$$]$_: LOGNAME=${LOGNAME} HOST=${HOST}${NL}"
Then examine your procmail log file after it processes and email,
provided you setup a logfile for procmail use.
This will at least log the information in the procmail log showing the
active user at the time the recipe is run.
If you are running the recipe out of /etc/procmailrc that may be root,
or if procmail has dropped privileges it may be that of the recipients
username, or it may be some other system user name used when handling
email if not root.
If you are running the recipe out of ${HOME}/.procmailrc then the
LOGNAME should be that of the user.
--
Garen
Re: procmail forwarding duplicates mails
am 02.08.2006 21:16:27 von Alan Connor
On comp.mail.misc, in <4jc82dF7a0k3U1@individual.net>, "Marko Faldix" wrote:
Correction: Someone who sometimes calls himself "Marko Faldix",
wrote:
> Path: text.usenetserver.com!atl-c01.usenetserver.com!news.usenetse rver.com!news2.euro.net!newsfeed.freenet.de!news.tu-darmstad t.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
> From: Marko Faldix
http://groups.google.com/advanced_group_search
Marko Faldix
Results 1 - 3 of 3 posts in the last year
1 comp.mail.misc
2 oecher.computer
Only three posts ever! Welcome to the Usenet!
You have a German email address? So could anyone.
Can you even find Germany on a map?
> Newsgroups: comp.mail.misc
> Subject: procmail forwarding duplicates mails
FAQ. But trolls don't like homework. They don't have time to
search:
http://groups.google.com/advanced_group_search
for the answers to FAQs on a newsgroup.
Too busy running their mouths under scores of aliases on
hundreds of newsgroups.
> Date: Wed, 02 Aug 2006 20:08:03 +0200
> Lines: 41
> Message-ID: <4jc82dF7a0k3U1@individual.net>
> Mime-Version: 1.0
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7Bit
> X-Trace: individual.net aK4Cb7mUkgDty35cmVribwvp+hDOjun7SlN8lFd1PElo4Jb4D9
Only Usenet pros use individual.net. And trolls love it because
there are no identifiers in the headers usable by ordinary
Usenetrs.
Which makes it very easy to create new sockpuppets...
> User-Agent: KNode/0.7.7
You are running Linux and a sophisticated newsreader.
> Xref: usenetserver.com comp.mail.misc:160055
> X-Received-Date: Wed, 02 Aug 2006 14:09:18 EDT (text.usenetserver.com)
http://slrn.sourceforge.net/docs/README.offline>
Troll. Phukk off.
Note: I won't be downloading any articles on this thread.
Alan
--
See my headers.
Re: procmail forwarding duplicates mails
am 05.08.2006 12:30:03 von Marko Faldix
Hi Garen,
Garen Erdoisa wrote:
> Marko Faldix wrote:
>> Hello,
>> [snip]
>>
>> My question is:
>> Now if send an email addressed to both info@1.example.com and
>> info@2.example.com then each of them will get it twice.
>
[...]
Thank you very much. I made some experiments and at last I wrote all headers
to a file. As result from new and old mails I can tell:
If X-Original-To is there than this is what I am looking for and quite easy
to regexp.
If X-Original-To is not there than the required recipient adress is in the
first "Received:"-Header with an adress in it like this way:
Received: from ...
by ...
for ; ...
sometimes it is with brackets < > and sometimes without. It is now just a
question to find appropiate regular expression for the "Received"-Header
and to find out if it's structure is always the way mentioned above. I
think so except there is no adress given in the "Received"-header.
Marko
Re: procmail forwarding duplicates mails
am 06.08.2006 23:11:39 von gtaylor
On 08/05/06 05:30, Marko Faldix wrote:
> sometimes it is with brackets < > and sometimes without. It is now just a
> question to find appropiate regular expression for the "Received"-Header
> and to find out if it's structure is always the way mentioned above. I
> think so except there is no adress given in the "Received"-header.
You will want to write your RE to match your server's Received header. You
can predict what your server will put in there but you can not predict what
another server will put.
Grant. . . .