@lbutlr | 23 Mar 18:22 2015

strange error in my procmailrc

when the procmailrc hands off mail for my personal account it logs an error:

User me <at> mail.covisp.net has a .procmailrc, processing...
date: illegal time format
usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... 
            [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]

None of the other accounts with .procmailrcs log this error, but when I look in my .procmailrc for date:

$ grep date /home/me/.procmailrc 
DATE=`date '+%d-%b-%Y'`
MDATE=`date '+%Y-%m'`
YDATE=`date '%Y'`
LONGDATE=`date "+%y-%b-%d %I:%M:%S %z"`
LOG="`date`${NL}Checking Spam Status... "
  LOG="done. `date`$NL"
  LOG="Delivered `date`$NL"
LOG="Delivered `date`$NL”

None of these seem like they should be throwing any sort of error. They all execute fine from the command line
and date is in /bin/ so I don’t think it could be a path problem. Also, there are not errors logged to my
procmailk log file, only to the global log file/

--

-- 
'You don't think you've had enough, do you?' he said. I KNOW WHEN I'VE
HAD ENOUGH. 'Everyone says that, though. I KNOW WHEN EVERYONE'S HAD
ENOUGH. --Moving Pictures

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
(Continue reading)

Alan Clifford | 23 Mar 16:22 2015

Any dangers with this recipe?


I know I'm probably being petty and unreasonable but there we are.  A 
couple of events have really annoyed me.

Firstly, I politely asked a company to stop sending emails to an address. 
They said the couldn't and I think they quoted the data protection act. 
They said I had to do it myself on their website.  Hmmm, was that true?

The second event was a company that sent me several emails on the same day 
to an address that only appears as a contact address on my website.  I 
wondered if I could persuade them to stop.  As I don't want the website 
email address to be repeated here, I've used xxxx <at> example.com in the 
recipe below.

I've attempted to target specific people at the company concerned to annoy 
them with their own email spew. devnull <at> clifford.ac is rejected by 
sendmail so hopefully no mail loop.  And I tagged my gmail address I use 
for testing onto the the list of recipients so I could see what I was 
sending out.

Any problems/dangers?

:0
* ^to:.*xxx <at> example\.com
* ^from:.*michael <at> smmexevent\.com
{
   :0 c
   | $SENDMAIL -oi -f devnull <at> clifford.ac 
michael <at> smmexevent.com,michael=smmexevent.com <at> mail15.atl161.mcsv.net,postmaster <at> smmexevent.com,domain-admin <at> donhost.co.uk

(Continue reading)

Zhiliang Hu | 20 Feb 15:46 2015

help with a recipe

I have a recipe to sack all maildaemon mails to a file:

  :0 H
  * ^FROM_DAEMON|^FROM_MAILER|^From:.*(MAILER-DAEMON|spam_master|postmaster|ait-admin|Mail 
Delivery|bounce <at> )|^To:.*-request
  * ^Subject:.*(Error Condition|DELIVERY FAILURE|Delivery Status Notification|Delivery
delayed|Returned mail|Undeliverable|failure 
notice|Warning: could not send message)
  Mailerror

(Note /* ^FROM_DAEMON/ and /* ^Subject/ lines may be wrapped in this mail; 
the 4th line is "Mailerror".)

However it misses mail bounces like:

  From: postmaster <at> xxx.xxxxxxx.xx
  To: xxxxxxx-request <at> xxxxxxxxxx.xxx
  Subject: Undeliverable: xxxxxxxxxx

I could not find but does my construct have a problem?

Zhiliang
Julianony M | 31 Jan 22:13 2015
Picon

procmailrc to match body

I wrote a set of procmailrc recipes to "quarantine" certain category of
incoming mails to my site. It works with 3 simple steps: when a mail meets
certain criteria, it triggers a "quarantine" process by (1) holding the mail while send a confirmation mail to the sender; (2) when the confirmation mail is replied by the sender, the mail gets delivered normally; (3) when the confirmation mail is bounced, the mail is trashed.

So far everything worked well.

Lately I noticed a minor problem with my recipes to recognize certain bounced mails (a small proportion of all bounced).

My recipe to catch bounces is like:

:0
* ^FROM_DAEMON|^FROM_MAILER
* ^To:.*(mailmaster <at> xxxxxx.xxx)
{
   :0 B
   * ^.*Verify the mail you sent: \/[0-9a-zA-Z\.]+
   {
     MATCHED="$MATCH"

     :0 fw
     | cat "$MAILDIR/QUARRENTEEN/$MATCHED" >> $SPAM;

     :0 a
     | echo 'bounced, go to spam' > "$MAILDIR/QUARRENTEEN/$MATCHED"
   }

   :0 e
   /var/mail/Mail-error
}

which works well for most except one type of bounces from certain mail daemon, with multi-parts:

----------start quote---------------------
From: Mail Delivery Subsystem <MAILER-DAEMON <at> xxxxxx.xxx>
Subject: Returned mail: see transcript for details

(omitted)

   [ Part 2: "Delivery Status" ]

(omitted)

   [ Part 3: "Included Message" ]

 Date: Wed, 28 Jan 2015 14:05:32 -0600
 From: mailmaster <at> xxxxxxxx.xxx
 To: xxxxxxxxxxxxx <at> xxxxxxxxxxxxxxx.us
 Subject: Verify the mail you sent: 20150128.140532KAMGTNXTV

 This mail hub is withholding a mail just received from you:
  - sent to <xxxxxxxx <at> xxxxxxxxxx.xxx>
  - with the Subject: "Find lost or stolen items from your iPhone."
 
 This is to verify that the mail from your mailbox is not a spam.
 Please confirm by replying this mail (no need to write anything;
 only be sure to include this mail in the reply, and leave the Subject
 line and mail body as they are):
 
   Verify the mail you sent: 20150128.140532KAMGTNXTV
 
 Your mail will be automatically delivered when the system receives
 this confirmation from you.
 
 Thank you.
----------------end quote-----------------------

which fell into "Mail-error". It appears the body match failed. Any advice how the recipe should be modified in order to catch this?

Thanks, joe

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail <at> lists.RWTH-Aachen.de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
Richard Z | 3 Jan 17:10 2015

procmail local delivery and aliases expansion

Hi,

I am using esmtp which in turn uses "procmail -d %T" for local
mail delivery - and would prefer to avoid installing any of the
big sendmail-like packages.

Problem is, procmail does not expand aliases when used like this 
so mail from daemons to root etc ends up in the wrong places.

Coding the alias expansion myself should not be too difficult but
perhaps it has been done before?

Richard

---
Name and OpenPGP keys available from pgp key servers
Danny | 4 Dec 12:35 2014
Picon

Mail forward question

Hi Guys,

I have a working procmail setup that has been running for some time. When I
first did the configuration I had some mail being forwarded to another user on
the same system (Debian Weezy). However, now and then I would do some
maintenance. I noticed that the mail never got forwarded to user "shotgun".

Here is the recipe:

:0:
* ^(From|Cc|To|X-Loop|Sender|Bcc|X-BeenThere):.*newsletter <at> list\.rockauto\.com
#* ^TO_admin <at> iaftercare\.com
! shotgun <at> fever.havannah.local
$MAILDIR/incoming/offroading/rockauto

As you can see the mail is supposed to be placed in the folder "rockauto" which
is done, but it is not being forwarded to the user
"shotgun <at> fever.havannah.local" ...

Any particular reason why?

I am running Debian Weezy (or is it Wheezy?) ... Postfix 2.something ... fetchmail
something.something ... 

Thank You

Danny
Zhiliang Hu | 2 Dec 15:56 2014

help with a procmailrc recipe

To fight against increasingly aggressive spam mails, besides spam-assassin and 
a couple dozen filters I use to trash sure-spams, there still remain some mixed 
mails where I have to manually fish out good from bad or bad from good mails.

For this "small" portion of mails, I wrote a recipe to send automated inquery 
mails to verify if a suspecious mail is from a human-being: if it gets a human 
reply to confirm, the saved mail gets further delivered; if the inquery mail 
gets bounced, the saved mail gets deleted.  So far everything works fine except 
this last recipe to process bounce/delete:

:0
* ^FROM_DAEMON|^FROM_MAILER
{
    :0 w:bb.lock
    * B ?? Subject: verify mail you sent: ([0-9\.]{15}[A-Z]{9})
    THEMATCH = $MATCH

      :0 a
      | rm -f /var/mail/QUARRENTEEN/$THEMATCH

    :0 E:
    Mailerrors
}

The problem is that the saved file name is not caught by regular expression 
match. My auto-inquery mail "Subject:" line is like:

  Subject: verify mail you sent: 20141127.120132MUUNJUEDC

(Note this line is placed in the mail body in a bounce). I suspect if my regex 
is "perl" like and not supported by procmail or else?

Thanks in advance,

Zhiliang
Zhiliang Hu | 29 Nov 07:19 2014

help with a procmailrc recipe

To fight against increasingly aggressive spam mails, besides 
spam-assassin and a couple dozen filters I use to trash sure-spams, there 
still remain some mixed mails where I have to manually fish out good from 
bad or bad from good mails.

For this "small" portion of mails, I wrote a recipe to send automated 
inquery mails to verify if a suspecious mail is from a human-being: if it 
gets a human reply to confirm, the saved mail gets further delivered; if 
the inquery mail gets bounced, the saved mail gets deleted.  So far 
everything works fine except this last recipe to process bounce/delete:

:0
* ^FROM_DAEMON|^FROM_MAILER
{
    :0 w:bb.lock
    * B ?? Subject: verify mail you sent: ([0-9\.]{15}[A-Z]{9})
    THEMATCH = $MATCH

      :0 a
      | rm -f /var/mail/QUARRENTEEN/$THEMATCH

    :0 E:
    Mailerrors
}

The problem is that the saved file name is not caught by regular 
expression match. My auto-inquery mail "Subject:" line is like:

  Subject: verify mail you sent: 20141127.120132MUUNJUEDC

(Note this line is placed in the mail body in a bounce). I suspect if my 
regex is "perl" like and not supported by procmail or else?

Thanks in advance,

Zhiliang
Richard Reina | 29 Oct 19:30 2014
Picon

Can anyone help fixing a recipe?

I've been using the recipe below and it does what I want except one thing. If the conditional that begins with
* ? /usr/bin/perl -e 'require "/home/richard/.pmdir/test_subject.pl"; test_subject($ENV{SUBJECT});'
receives a "0" as the exit code of the perl script it executes the formail and ssmtp command which is what I want.  The problem is that the recipe continues executing.  I would like it to stop if the condition is met ( exit code "0"). That is if the test_subject() subroutine exits with a zero, I wan't it to return the email with formail and ssmtp and then STOP. Can anyone tell me what I am doing wrong?

#grab the from
FROM=""
:0
* ^FROM:.*
* ^From:[    ]*\/[^  ].*
{
       FROM=$MATCH
}
#grab the subject
SUBJECT=""
:0
* ^FROM:.*
* ^Subject:[    ]*\/[^  ].*
{
       SUBJECT=$MATCH
}
:0 W # send to test_subject.pl to check for PO no.
* ? /usr/bin/perl -e 'require "/home/richard/.pmdir/test_subject.pl"; test_subject($ENV{SUBJECT});'
|( formail -rI"From: No Reply <fpls545 <at> gmail.com>"; \
  echo "Your mail has been returned."; \
  echo "It was NOT received because it does not contain a valid Load Number in the subject"; \
  echo "Please resubmit with the PO Number (see Rate Confirmation) in the subject line."; \
  ) | /usr/sbin/ssmtp -oi -t;

:0 W # VALID PO NO test it to make sure it was not already processessed and or paid
* ? /usr/bin/perl -e 'require "/home/richard/.pmdir/test_subject.pl"; test_if_billed($ENV{SUBJECT},$ENV{FROM});'
work # already billed

:0 ifw  # has not been billed rip & save attachements 

|ripmime -i - -d /home/richard/.pmdir/attachments/ &&\
/usr/bin/perl -e 'require "/home/richard/.pmdir/test_subject.pl"; rename_att($ENV{SUBJECT}); exit(0)'

:0 A
invoices

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail <at> lists.RWTH-Aachen.de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
LuKreme | 23 Oct 03:43 2014

Duplicate emails

Can anyone tell where in this verbose log the incoming message is becoming two messages? It appears to me
that it happens at the call to spamc which I've highlighted.

:0 fw
| spamc

procmail: [22405] Wed Oct 22 19:29:37 2014
procmail: No match on "Subject.*New List Mail$"
procmail: No match on "^FROM_DEAMON"
procmail: Assigning "READLIST=/home/kremels/.readlist"
procmail: Executing "grep,-i,^dmarkman <at> mac.com,/home/kremels/.readlist"
procmail: Assigning "READIT="
procmail: Assigning "MATCH="
procmail: Matched " bbedit <at> googlegroups.com"
procmail: Match on "^To:(.*\<)?\/.*"
procmail: Assigning "TO= bbedit <at> googlegroups.com"
procmail: No match on "X-spam-status:(.*\<)?\/.*"
procmail: No match on "From:(.*\<)?root <at> (mail)?.covisp.net"
procmail: No match on "^Subject:.*\["
--->> procmail: Executing "spamc"
procmail: [22400] Wed Oct 22 19:29:37 2014
procmail: No match on "Subject.*New List Mail$"
procmail: No match on "^FROM_DEAMON"
procmail: Assigning "READLIST=/home/kremels/.readlist"
procmail: Executing "grep,-i,^dmarkman <at> mac.com,/home/kremels/.readlist"
procmail: Assigning "READIT="
procmail: Assigning "MATCH="
procmail: Matched " bbedit <at> googlegroups.com"
procmail: Match on "^To:(.*\<)?\/.*"
procmail: Assigning "TO= bbedit <at> googlegroups.com"
procmail: No match on "X-spam-status:(.*\<)?\/.*"
procmail: No match on "From:(.*\<)?root <at> (mail)?.covisp.net"
procmail: No match on "^Subject:.*\["
--->> procmail: Executing "spamc"
procmail: [22405] Wed Oct 22 19:29:39 2014
procmail: Executing "echo "$MATCH" | sed 's/[    ]\{1,\}/ /g'"
procmail: [22405] Wed Oct 22 19:29:39 2014
procmail: Assigning "SPAM= bbedit <at> googlegroups.com"
procmail: No match on "^X-Spam-Status:(.*\<)?Yes"
procmail: Assigning "INCLUDERC=/home/kremels/.list_procmail"
procmail: Assigning "LISTNAME"
procmail: Score:       0       0 "^(List-Post:[    ]*(<mailto:)?|List-Owner:[      ]*(<mailto:)?owner-)\/[-A-Z0-9_+]+"
procmail: Assigning "MATCH="
procmail: Matched "bbedit"
procmail: Score: 2147483647 2147483647 "^(List-Id:.*<|X-Mailing-List:[   ]*)\/[-A-z0-9_+]+"
procmail: Assigning "LISTNAME=bbedit"
procmail: No match on "()\/[-A-Z0-9_+]+-(users|user)"
procmail: Assigning "LOG=bbedit
"
bbedit
procmail: Assigning "INCLUDERC=/home/kremels/.list_local"
procmail: Executing "formail,-IX-Covisp-prelocal: bbedit"
procmail: No match on "^List-Post: <mailto:\/[-A-Z0-9_+]+ <at> [-A-Z0-9_+.]+"
procmail: No match on "^^google"
procmail: Match on "^^bbedit"
procmail: Assigning "SWITCHRC"
procmail: Match on ! "LISTNAME ^^^^"
procmail: Executing "formail,-IX-Listname: bbedit"
procmail: No match on "NO"
procmail: Match on ! "^^^^"
procmail: [22400] Wed Oct 22 19:29:39 2014
procmail: Executing "echo "$MATCH" | sed 's/[    ]\{1,\}/ /g'"
procmail: [22400] Wed Oct 22 19:29:39 2014
procmail: Assigning "SPAM= bbedit <at> googlegroups.com"
procmail: No match on "^X-Spam-Status:(.*\<)?Yes"
procmail: Assigning "INCLUDERC=/home/kremels/.list_procmail"
procmail: Assigning "LISTNAME"
procmail: Score:       0       0 "^(List-Post:[    ]*(<mailto:)?|List-Owner:[      ]*(<mailto:)?owner-)\/[-A-Z0-9_+]+"
procmail: Assigning "MATCH="
procmail: Matched "bbedit"
procmail: Score: 2147483647 2147483647 "^(List-Id:.*<|X-Mailing-List:[   ]*)\/[-A-z0-9_+]+"
procmail: Assigning "LISTNAME=bbedit"
procmail: No match on "()\/[-A-Z0-9_+]+-(users|user)"
procmail: Assigning "LOG=bbedit
"
bbedit
procmail: Assigning "INCLUDERC=/home/kremels/.list_local"
procmail: Executing "formail,-IX-Covisp-prelocal: bbedit"
procmail: No match on "^List-Post: <mailto:\/[-A-Z0-9_+]+ <at> [-A-Z0-9_+.]+"
procmail: No match on "^^google"
procmail: Match on "^^bbedit"
procmail: Assigning "SWITCHRC"
procmail: Match on ! "LISTNAME ^^^^"
procmail: Executing "formail,-IX-Listname: bbedit"
procmail: No match on "NO"
procmail: Match on ! "^^^^"
procmail: Assigning "LASTFOLDER=.bbedit/new/1414027779.22405_0.mail.covisp.net"
procmail: Notified comsat: "kremels <at> 0:/home/kremels/Maildir//.bbedit/new/1414027779.22405_0.mail.covisp.net"
From bbedit+bncBD2JVBEQGUIP7M5BUICRUBFKR334A <at> googlegroups.com  Wed Oct 22 19:29:37 2014
 Subject: Re: javascript OSA script component
  Folder: .bbedit/new/1414027779.22405_0.mail.covisp.net                   8025
procmail: Assigning "LASTFOLDER=.bbedit/new/1414027779.22400_0.mail.covisp.net"
procmail: Notified comsat: "kremels <at> 0:/home/kremels/Maildir//.bbedit/new/1414027779.22400_0.mail.covisp.net"
From bbedit+bncBD2JVBEQGUIP7M5BUICRUBFKR334A <at> googlegroups.com  Wed Oct 22 19:29:37 2014
 Subject: Re: javascript OSA script component
  Folder: .bbedit/new/1414027779.22400_0.mail.covisp.net                   8025

--

-- 
The only way of discovering the limits of the possible is to venture a
little way past them into the impossible.
Chris | 21 Oct 04:00 2014

formail recipe that queries asn.routeviews.org

I've a formail recipe embedded in my .procmailrc file that it's purpose
is to parse out the senders ASN and CIDR. The output of looks like this:
X-senderip: 168.244.164.171
X-asn: ASN-21789
X-cidr: 168.244.164.0/24

Here is the recipe:

RAW_ASN=`host -W 6 -R 10 -t txt $REVERSE_SENDERIP.asn.routeviews.org |
sed -e 's/.* text //' -e 's/"//g'`

ASN = `echo $RAW_ASN | cut -d ' ' -f 1`
ASN_CIDR = `echo $RAW_ASN | cut -d ' ' -f 2`/`echo $RAW_ASN | cut -d ' '
-f 3`
LOG = "ASN= $ASN"

Then the procmail recipes that add this to the message header:

------------------------------------------------------------------------ 
# Add X-SenderIP header.
:0 fhw
* ! ^X-SenderIP:
| $FORMAIL -a "X-SenderIP: $SENDERIP"
#
------------------------------------------------------------------------ 

#
------------------------------------------------------------------------ 
# Add X-ASN header.
:0 fhw
* ! ^X-ASN:
| $FORMAIL -a "X-ASN: ASN-$ASN"
#
------------------------------------------------------------------------ 

#
------------------------------------------------------------------------ 
# Add X-CIDR header.
:0 fhw
* ! ^X-CIDR:
| $FORMAIL -a "X-CIDR: $ASN_CIDR"
#
------------------------------------------------------------------------  

The problem I'm having is that in my procmaillog I'm seeing this
periodically:

host: '.asn.routeviews.org' is not a legal name (empty label)
ASN= From cpollock <at> embarqmail.com  Mon Oct 20 11:41:44 2014
 Subject: Cron <chris <at> localhost> fetchmail
--quit; /usr/local/bin/fetchmail -v 
  Folder: /home/chris/Maildir/new/1413823304.2785_1.localhost	

It's not constant as far as what incoming messages it decides to fail
on. I've contacted routeviews.org and they've assured me that the issue
doesn't seem to be there. Since this is a new setup using Ubuntu and
previously in my old Mandriva box I had no issues I'm wondering if it's
a system problem or a problem with the recipes?

Thanks
Chris

--

-- 
Chris
KeyID 0xE372A7DA98E6705C
31.11°N 97.89°W (Elev. 1092 ft)
20:23:04 up 55 min, 2 users, load average: 0.08, 0.21, 0.27
Ubuntu 14.04.1 LTS, kernel 3.13.0-38-generic

Gmane