Re: OT: help conditioning on multiple fields using procmail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you all for your suggestions. I am a little lost because none of them have done what I want to do. So, let me explain what I am trying to do.

I am getting all my e-mail forwarded from user@xxxxxxxxxxx to another e-mail address, say: user@xxxxxxxxx.

I send myself outgoing e-mails (BCc'ed). These all come from the same e-mail address, that is mine.

Almost all forwarded e-mails have a Resent-From: field set to be: user@xxxxxxxxxxx in the mail envelope. However, not all of them. Some of these e-mails (appears to be the ones sent within my organization) do not have this field even though they are also forwarded.

I want to use procmail to store all the mails (and only those e-mails) with the From: user@xxxxxxxxxxx to my $HOME/Mail/sent folder.

How do I do this? I don't know if this matters but I use: 'procmail -d %s' when procmail is invoked by my fetchmail.

Many thanks and best wishes,
Ranjan







On Mon, 23 Dec 2019 22:55:25 -0600 Ranjan Maitra <maitra@xxxxxxxxx> wrote:

> Thank you for your help and in detailing the process. Adding the colon to the From: does not prevent e-mail having the Resent-From set at the same e-mail address.
>
> I am trying out your other suggestion.
>
> Thanks again!
>
> Best wishes,
> Ranjan
>
>
> On Tue, 24 Dec 2019 12:09:38 +0900 "Stephen J. Turnbull" <steve@xxxxxxxxxx> wrote:
>
> > Ranjan Maitra writes:
> >
> >  > So, I use in my .procmailrc:
> >  >
> >  > :0:
> >  > *^From.*user@xxxxxxxxxxx
> >  > $HOME/Mail/sent/.
> >  >
> >  > And it used to work fine. However, recently I have also started
> >  > forwarding my e-mail from the address: user@xxxxxxxxxxx and what is
> >  > happening is that the e-mail envelope of every forwarded message
> >  > now contains the header: Resent-From.*user@xxxxxxxxxxx so all
> >  > forwarded e-mail is being saved to the sent folder.
> >
> > Based on your report, one possibility is that your recipe is catching
> > the "Unix From" line (also called "envelope From line"), which has the
> > form
> >
> > From <optional stuff> user@xxxxxxxxxxxx <optional stuff>
> >
> > and is prepended to emails saved in so-called mbox format.  (This is
> > not part of the RFC 5322 Internet Message Format.  It is specific to
> > the way mail is handled locally by *some* configurations of *some*
> > message delivery agents.  It is not normally displayed by mail
> > clients.)  If this is the case, changing the recipe to
> >
> > :0:
> > *^From:.*user@xxxxxxxxxxx
> > $HOME/Mail/sent/.
> >
> > (change is colon after From) should catch only messages with an RFC
> > 5322 From "user@xxxxxxxxxxx".
> >
> >  > Is it possible to have a double condition? That is something that
> >  > says that if both Resent-From and From have *user@xxxxxxxxxxx, then
> >  > it should go to the sent-folder. In other words, is it possible to
> >  > use a AND or OR or Negation condition.
> >
> > I'll answer the question, but first I gotta preach. ;-)  When you
> > don't understand the problem, it is bad practice to ask questions in
> > the form "how do I do ...", because respondents are likely to focus on
> > the how of doing what you specifically asked, not on solving your
> > problem.  That's OK in some sense, you'll learn something, but it's
> > likely to be frustrating when you do what you're told and it doesn't
> > solve the underlying problem.
> >
> > To AND conditions:
> >
> > :0:
> > * ^From:.*user@xxxxxxxxxxx
> > * ^Resent-From:.*user@xxxxxxxxxxx
> > $HOME/Mail/sent/.
> >
> > and BOTH conditions must match the header of the email.  To OR
> > conditions, use separate recipes.
> >
> > :0:
> > * ^From:.*user@xxxxxxxxxxx
> > $HOME/Mail/sent/.
> >
> > :0:
> > * ^Resent-From:.*user@xxxxxxxxxxx
> > $HOME/Mail/sent/.
> >
> > and if either condition matches the header of the mail, the mail will
> > be saved in $HOME/Mail/sent/. .  Most procmail recipes terminate
> > processing on match, so order can matter (but does not in this case
> > because there are no side effects and the action is the same).  To
> > NEGATE a condition, use ! in the recipe:
> >
> > :0:
> > * ! ^Resent-From:.*user@xxxxxxxxxxx
> > $HOME/Mail/sent/.
> >
> > sending anything NOT Resent-From user@xxxxxxxxxxx to .../sent/.
> >
> > The recipe that MIGHT do what you want if the colon suggestion doesn't
> > work:
> >
> > :0:
> > * ^From.*user@xxxxxxxxxxx
> > * ! ^Resent-From.*user@xxxxxxxxxxx
> > $HOME/Mail/sent/.
> >
> > (look Ma, no colons!, and the Resent-From condition is negated).
> >
> > HTH
> >
> > Steve
> > XEmacs Project
> > GNU Mailman Project
> > _______________________________________________
> > users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
> > To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
> > Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> > List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> > List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
>
>
> --
> Important Notice: This mailbox is ignored: e-mails are set to be deleted on receipt. Please respond to the mailing list if appropriate. For those needing to send personal or professional e-mail, please use appropriate addresses.
> _______________________________________________
> users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
> Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx


--
Important Notice: This mailbox is ignored: e-mails are set to be deleted on receipt. Please respond to the mailing list if appropriate. For those needing to send personal or professional e-mail, please use appropriate addresses.
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux