procmail
[Top] [All Lists]

Re: Use of B ?? and $MATCH

2005-10-21 09:05:55
On Tue, 18 Oct 2005 09:44:44 -0500 (Central Standard Time) "Gerald V. 
Livingston II" <debuser(_at_)sysmatrix(_dot_)net> wrote:

I already have recipes in place that grab these messages and file them in a
special folder so if I'm near a net connected machine I know I have a new
VM and can listen to it.

But right now I'm AWAY from net connected machines a lot and I need to get
the "Date" and "From" lines out of the body and write them to a file I can
send to my cell phone's SMS email address so I know I have a new VM and who
it's from. I can decide from that if I need to check the VM immediately or
if it can wait until I'm not busy. 

I've gotten this far in my experiments but either my nesting or my regex
constructs are hosed up because it is sending me a blank message: (wrapping
is going to kill the two long pipe lines for cat and sendmail)

I'd like to thank those who pointed out my screwed up regex (a BIG weakness
for me), brain dead 'cat rather than echo' error, and general recipe faux
pas.

For the archives here is the current incarnation that appears to be working
as required and one small question:

#Vonage stuff
:0
* ^From:(_dot_)*14095551212(_at_)vm\(_dot_)vonage\(_dot_)com
* B ?? Date:\/.* [AP]M
{ VMDATE="Date- $MATCH $NL" }
:0
* ^From:(_dot_)*14095551212(_at_)vm\(_dot_)vonage\(_dot_)com
* B ?? From:\/.*\)
{ VMFROM="From- $MATCH $NL" }
:0
* ^From(_dot_)*14095551212(_at_)vm\(_dot_)vonage\(_dot_)com
* ! ^X-loop: gvl2(_at_)sysmatrix(_dot_)net
{
:0c
|echo "Subject: Voicemail">/tmp/vmmail;\
echo $VMDATE >>/tmp/vmmail;\
echo $VMFROM >> /tmp/vmmail;\
/usr/sbin/sendmail -oi 
4095552121(_at_)messaging(_dot_)sprintpcs(_dot_)com</tmp/vmmail;\
rm -f /tmp/vmmail
}

:0
* ! ^From(_dot_)*14095551212(_at_)vm\(_dot_)vonage\(_dot_)com
* ! ^From(_dot_)*customerservice(_at_)vonage\(_dot_)com
* ! ^From(_dot_)*questions(_at_)vonage\(_dot_)com
* ! ^From(_dot_)*billing(_at_)vonage\(_dot_)com
{ }
:0 E:
.sysmatrix-net.0-junkmail.vonage/


I dropped adding the X-Loop because I'm no longer delivering a copy to
myself for testing and I dropped the use of the '-f' option of sendmail
because the "altered sender" warning was causing delivery delays on the
Sprint SMS side (and I don't particularly care what the "From address" says
on the text message).

Someone sent me an off-list message suggestion I simply pipe the echo
statements to sendmail rather than writing a temp file. I considered that
then remembere WHY I was using a temp file in my testing. Note that in the
above recipe I have separated the temp file creation into several echo
statements. That's because echo on my system does *NOT* honor the insertion
of the NEWLINE character. Sending 'echo "Subject: Voicemail" $VMDATE $NL
$VMFROM' would get a line like :

Subject: Voicemail Date- Oct 12 2005 From- Outside Caller (14445551212)

By sending separate echo commands using >> to append to the file each
variable goes on a separate line as:

Subject: Voicemail
Date- Oct 12 2005
From- Outside Caller (14445551212)

Right now the only "problem" I see is this error in the log:

procmail: Executing "echo "Subject: Voicemail">/tmp/vmmail;\
echo $VMDATE >>/tmp/vmmail;\
echo $VMFROM >> /tmp/vmmail;\
/usr/sbin/sendmail -oi 
4095552121(_at_)messaging(_dot_)sprintpcs(_dot_)com</tmp/vmmail;\
rm -f /tmp/vmmail"
procmail: Error while writing to "echo "Subject: Voicemail">/tmp/vmmail;\
echo $VMDATE >>/tmp/vmmail;\
echo $VMFROM >> /tmp/vmmail;\
/usr/sbin/sendmail -oi 
4095552121(_at_)messaging(_dot_)sprintpcs(_dot_)com</tmp/vmmail;\
rm -f /tmp/vmmail"
procmail: Assigning "LASTFOLDER=echo "Subject: Voicemail">/tmp/vmmail;\
echo $VMDATE >>/tmp/vmmail;\
echo $VMFROM >> /tmp/vmmail;\
/usr/sbin/sendmail -oi 
4095552121(_at_)messaging(_dot_)sprintpcs(_dot_)com</tmp/vmmail;\
rm -f /tmp/vmmail"

It works, but issues an error for the first "echo" statement?? Ideas? Do I
need to change to single quotes in the initial 'echo "Subject..."' action?

Thanks all,

Gerald

____________________________________________________________
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>