KirAsh4 | 13 Jan 2011 22:37
Picon

Procmail Help

    Procmail is considered a scripting language, right?  Right?
Right? :)

    Anyway, I need some words of wisdom here.  At the moment, I'm
using a short procmail script that forwards incoming email to gmail
and only delivers it to the final mailbox if it comes back from
gmail.  It's a crude way of filtering for SPAM since Gmail is much
better at it:

    :0
    * !^X-Forwarded-For: kirash4@... ashley@...
    * !^From.*kirash4@...
    ! kirash4@...

    This works really well.  Email arrives at our server, procmail
sees that it hasn't passed through Gmail and sends it on to my Gmail
address.  Gmail scans it, deems it legitimate and sends it back (via
Gmail's internal forwarding).  When it arrives back at our server,
procmail sees the X-Forwarded for and delivers it in my INBOX.

    But now I need to augment this a bit and forward those emails to a
second mailbox, but ONLY those that are coming back from Gmail.
Basically, when procmail sees the X-Forwarded for, it needs to forward
that massage to a second mailbox besides dropping it into my INBOX.  I
can't just put a forward line at the bottom because then it simply
forwards and doesn't drop in my INBOX.

    Suggestions?

(Continue reading)

Roger | 13 Jan 2011 23:37
Picon

Re: Procmail Help

After your current recipe, would something like:
:0  c
* ^X-Forwarded-For: kirash4@... ashley@...
| secondemail <at> address
 ###  'c' essentially means a copy of the email, even if it matches, a
copy drops through.

If that condition exists, then send a copy to that second address.
The original forwarded  would still fall through and go to primary
mailbox..  (I think)

Is that what you want?
in summary, your recipe combined with the one above.

New email arrives for you, if it hasn't been forwarded, then send it
off to gmail for spam check.  once it comes back (via google forward),
the 1st recipe ignores it.  the second recipe (above), would then
forward a copy to the second address in addition to the primary
mailbox.

Roger

On Thu, Jan 13, 2011 at 1:37 PM, KirAsh4 <kirash4@...> wrote:
>    Procmail is considered a scripting language, right?  Right?
> Right? :)
>
>    Anyway, I need some words of wisdom here.  At the moment, I'm
> using a short procmail script that forwards incoming email to gmail
> and only delivers it to the final mailbox if it comes back from
> gmail.  It's a crude way of filtering for SPAM since Gmail is much
(Continue reading)

KirAsh4 | 18 Jan 2011 17:51
Picon

Re: Procmail Help


    Well, all of what you said and the way I understand the various
recipes I've been scouring online, all of it makes sense.  But for
some reason it's not working.  Procmail is doing the first part, and
ignoring the second part (it's not copying the message when it returns
from GMail.)  And I can't figure out why.  This is what the recipe
looks like now:

:0
* !^X-Forwarded-For: kirash4@... ashley@...
* !^From.*kirash4@...
! kirash4@...

:0c
* ^X-Forwarded-For: kirash4@... ashley@...
| ashley-archive@...

(having a space between 0 and c doesn't seem to make any difference,
but this is also how many recipes are written, without the space.)

I have double checked the returning message from GMail and the X-
Forwarded line is spot on accurate.  So what am I missing here?  How
can I trace it or figure out why it's not running the second recipe
and just drops it in my INBOX without the forward?  I wonder what
would happen if I reverse the rules ... if the second one will fail
(and thus not forward to GMail at all.)

A

On Jan 13, 3:37 pm, Roger <roger.in.eug...@...> wrote:
(Continue reading)

Roger | 18 Jan 2011 18:42
Picon

Re: Re: Procmail Help

I think you can enable verbose loggging to see what's going on.

spaces are critical.     Perhaps you need to account for possible
spaces in the 'x-forwarded-for' line?

I honestly don't know about having two addresses on the one line.
Does that line appear exactly in the header or are you trying to have
it catch for both addresses?
If it could have either address, but not both, you'll need two recipes.

* ^X-Forwarded-For: kirash4@...
 | ashley-archive@...

* ^X-Forwarded-For: ashley@...
 | ashley-archive@...

On Tue, Jan 18, 2011 at 8:51 AM, KirAsh4 <kirash4@...> wrote:
>
>    Well, all of what you said and the way I understand the various
> recipes I've been scouring online, all of it makes sense.  But for
> some reason it's not working.  Procmail is doing the first part, and
> ignoring the second part (it's not copying the message when it returns
> from GMail.)  And I can't figure out why.  This is what the recipe
> looks like now:
>
> :0
> * !^X-Forwarded-For: kirash4@... ashley@...
> * !^From.*kirash4@...
> ! kirash4@...
>
(Continue reading)

KirAsh4 | 18 Jan 2011 19:09
Picon

Re: Procmail Help

Nope, that's how it shows up in the headers.  I've literally copied it
from the headers like that.  It's a GMail thing when you set
forwarding up.  And if it didn't work, then the first rule would also
fail, and I know that one works.

On Jan 18, 10:42 am, Roger <roger.in.eug...@...> wrote:
> I think you can enable verbose loggging to see what's going on.
>
> spaces are critical.     Perhaps you need to account for possible
> spaces in the 'x-forwarded-for' line?
>
> I honestly don't know about having two addresses on the one line.
> Does that line appear exactly in the header or are you trying to have
> it catch for both addresses?
> If it could have either address, but not both, you'll need two recipes.
>
> * ^X-Forwarded-For: kira...@...
>  | ashley-arch...@...
>
> * ^X-Forwarded-For: ash...@...
>  | ashley-arch...@...
>
> On Tue, Jan 18, 2011 at 8:51 AM, KirAsh4 <kira...@...> wrote:
>
> >    Well, all of what you said and the way I understand the various
> > recipes I've been scouring online, all of it makes sense.  But for
> > some reason it's not working.  Procmail is doing the first part, and
> > ignoring the second part (it's not copying the message when it returns
> > from GMail.)  And I can't figure out why.  This is what the recipe
> > looks like now:
(Continue reading)

KirAsh4 | 18 Jan 2011 19:47
Picon

Re: Procmail Help

Figures it out.  THat has to be a ! not | at the beginning of the
line:

:0c
* ^X-Forwarded-For: kira...@... ash...@...
! ashley-arch...@...

Having a | implies executing of a script or command.  The ! forwards
it properly.  Oops.  Oh, and this was resolved by looking at
procmail's verbose log file.  Thanks for the tip!

On Jan 18, 11:09 am, KirAsh4 <kira...@...> wrote:
> Nope, that's how it shows up in the headers.  I've literally copied it
> from the headers like that.  It's a GMail thing when you set
> forwarding up.  And if it didn't work, then the first rule would also
> fail, and I know that one works.
>
> On Jan 18, 10:42 am, Roger <roger.in.eug...@...> wrote:
>
> > I think you can enable verbose loggging to see what's going on.
>
> > spaces are critical.     Perhaps you need to account for possible
> > spaces in the 'x-forwarded-for' line?
>
> > I honestly don't know about having two addresses on the one line.
> > Does that line appear exactly in the header or are you trying to have
> > it catch for both addresses?
> > If it could have either address, but not both, you'll need two recipes.
>
> > * ^X-Forwarded-For: kira...@...
(Continue reading)

Todd A. Jacobs | 8 Feb 2011 22:05
Picon

Re: Procmail Help

On Jan 13, 2:37 pm, Roger <roger.in.eug...@...> wrote:
> After your current recipe, would something like:
> :0  c

This won't work, because procmail stops processing after a successful
delivery recipe. You'd need to use a conditional or copy block, such
as:

    # Processing stops after this block if mail is forwarded.
    :0
    * !^X-Forwarded-For: kira...@... ash...@...
    * !^From.*kira...@...
    ! kira...@...

    # We only get here if mail wasn't forwarded to Gmail.
    # Forward copy of email and keep going.
    :0c
    ! some@...

    # Optional explicit local delivery.
    :0:
    /your/inbox

You could leave off the explicit local inbox if you just want it going
to $ORGMAIL, but I put it there for clarity of the top-down nature of
procmail recipes.

Roger | 9 Feb 2011 00:22
Picon

Re: Re: Procmail Help

On Tue, Feb 8, 2011 at 1:05 PM, Todd A. Jacobs
<codegnome.consulting@...> wrote:
> On Jan 13, 2:37 pm, Roger <roger.in.eug...@...> wrote:
>> After your current recipe, would something like:
>> :0  c
>
> This won't work, because procmail stops processing after a successful
> delivery recipe. You'd need to use a conditional or copy block, such
> as:

Yeah, I know that about the 'c' for copy.    It had been a while since
I looked at procmail, I was just off on the recipe to do what he
wanted.


Gmane