procmail
[Top] [All Lists]

Use of B ?? and $MATCH

2005-10-18 08:03:02
OK, I can't find enough examples to get done what I need for now. Hurricane
Rita whopped us pretty good. Right now between cleaning up at the office,
cleaning up at home, and dealing with the various people to do that I don't
have time to answer my cell and talk to everyone who might be calling. So,
I only give out my home number as I always have. I use Vonage VOIP for my
home phone and when someone leaves me a voicemail it emails me a copy as a
.wav file attachment.

This is the pertinent part of one of those emails (I've munged the phone
numbers and replaced my domain with example.tld)

From: 14095551212(_at_)vm(_dot_)vonage(_dot_)com
To: junkmail(_at_)example(_dot_)tld
Subject: You have received a new voicemail message
Date: Wed, 12 Oct 2005 08:43:18 -0500
X-Mailer: UTStarcom
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="this is a boundary string for 
me:Bn4f552"
Message-Id: 
<20051012134318(_dot_)EAD851F010C(_at_)prodmx3(_dot_)vonage(_dot_)com>
X-Virus-Scanned: by amavisd-new-2.3.2 (20050629) (Debian) at sysmatrix.net

This message is in MIME format.  Since your mail reader does not understand
this format, some or all of this message may not be legible.

--this is a boundary string for me:Bn4f552
Content-Type: text/plain
Content-Disposition: inline

Date: Oct 12 2005 08:43:18 AM
From: Outside Caller (1255552121)
To  : Gerald V. Livingston II (14095551212)
You have 5 unreviewed message(s).


--this is a boundary string for me:Bn4f552
Content-Type: audio/wav; name="voice-message.wav"
Content-Transfer-Encoding: base64

UklGRhh+AgBXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YfR9AgAE4QThBOEE4QThBOEE
4QThBOEE4QThBOEE4QThBOEE4QThBOEE4QThBOEE4QThBOEE4QThBOEE4QThBOEE4QThBOEE4QTh

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)

#Vonage stuff
:0:
* ^From(_dot_)*14095551212(_at_)vm\(_dot_)vonage\(_dot_)com
* B ?? Date:\/.* $NL
{ VMDATE="$MATCH" }
:0:
* ^From(_dot_)*14095551212(_at_)vm\(_dot_)vonage\(_dot_)com
* B ?? From:\/.* $NL
{ VMFROM="$MATCH" }
:0c
* ^From(_dot_)*14097679213(_at_)vm\(_dot_)vonage\(_dot_)com
* ! ^X-loop: gvl2(_at_)sysmatrix(_dot_)net
{
:0
#|formail -A "X-loop: gvl2(_at_)example(_dot_)tld"

#|cat $VMDATE $NL $VMFROM > /tmp/vmmail;/usr/sbin/sendmail -oi -f 
gvl2(_at_)example(_dot_)tld 
4095556666(_at_)messaging(_dot_)sprintpcs(_dot_)com</tmp/vmmail;rm -f 
/tmp/vmmail

|formail -A "X-loop: gvl2(_at_)sysmatrix(_dot_)net";cat $VMDATE $NL $VMFROM > 
/tmp/vmmail;/usr/sbin/sendmail -oi -f gvl2(_at_)example(_dot_)tld 
gvl2(_at_)sysmatrix(_dot_)net</tmp/vmmail;rm -f /tmp/vmmail
}

With verbose=yes I get this in the log: (I chopped out the part where
procmail forked the copy and delivered it, properly, to my local folder)

procmail: Match on "^From(_dot_)*14095551212(_at_)vm\(_dot_)vonage\(_dot_)com"
procmail: No match on "Date:\/.* $NL"
procmail: Extraneous locallockfile ignored
procmail: Match on "^From(_dot_)*14095551212(_at_)vm\(_dot_)vonage\(_dot_)com"
procmail: No match on "From:\/.* $NL"
procmail: Extraneous locallockfile ignored
procmail: Match on "^From(_dot_)*14095551212(_at_)vm\(_dot_)vonage\(_dot_)com"
procmail: Match on ! "^X-loop: gvl2(_at_)example(_dot_)tld"
procmail: [6344] Tue Oct 18 00:12:59 2005
procmail: Executing "formail -A "X-loop: gvl2(_at_)example(_dot_)tld";cat 
$VMDATE $NL $VMFROM > /tmp/vmmail;/usr/sbin/sendmail -oi -f 
gvl2(_at_)example(_dot_)tld gvl2(_at_)example(_dot_)tld</tmp/vmmail;rm -f 
/tmp/vmmail"
procmail: [6344] Tue Oct 18 00:12:59 2005
procmail: Assigning "LASTFOLDER=formail -A "X-loop: 
gvl2(_at_)example(_dot_)tld";cat $VMDATE $NL $VMFROM > 
/tmp/vmmail;/usr/sbin/sendmail -oi -f gvl2(_at_)example(_dot_)tld 
gvl2(_at_)example(_dot_)tld</tmp/vmmail;rm -f /tmp/vmmail"
procmail: Notified comsat: "gvl2@:/home/gvl2/Maildir//formail -A "X-loop: 
gvl2(_at_)example(_dot_)tld";cat $VMDATE $NL $VMFROM > 
/tmp/vmmail;/usr/sbin/sendmail -oi -f gvl2(_at_)example(_dot_)tld 
gvl2(_at_)example(_dot_)tld</tmp/vmmail;rm -f /tmp/vmmail"
From 14095551212(_at_)vm(_dot_)vonage(_dot_)com  Tue Oct 18 00:12:58 2005
 Subject: You have received a new voicemail message
  Folder: formail -A "X-loop: gvl2(_at_)example(_dot_)tld";cat $VMDATE $NL $VMF 
  223045

If post-delivery wrapping makes this unreadable to those who might be able
to assist please let me know and I'll make more effort to provide a clean
copy. My own personal web server is offline until I get my office cleaned
up from the hurricane so I don't have a place to easily post a web copy
that won't wrap. I don't like to use the sysmatrix servers directly for my
"personal stuff".


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>