procmail
[Top] [All Lists]

Re: Mailman results for procmail (fwd)

2002-06-26 08:00:30
On 26 Jun, Igor Kolar wrote:
| Hi .
| 
| I'm working on SMS notification; when an email from a particular address
| arrives, i send a mail to an e-mail address of my mobile operator which
| then in turn then gets delivered via SMS.
| 
| The problem is I would like to include some of the email's header params
| in the body of the sent message. Namely:
| 
| :0 c
| * ^From(_dot_)*address(_at_)host(_dot_)com
|| echo 'New mail from address' | mail number(_at_)mobile-operator(_dot_)com
| 
| 
| Now what needs changing is the echoed line, specificly to:
| 
| echo 'New mail at <current time> from address: <subject> (<x> KB size)'
| 
| with:
| <current time> - current (date and) time
| <subject> - subject of the received mail
| <x> - the size of the mail
| 
| How do I insert the current time, mail subject and mail size to the jig?
| Via shell variables ($subject, $size) perhaps?
| 

Bad Subject: line. :-(

Assuming address(_at_)host(_dot_)com will be the ENVELOPE sender, maybe this is
close:

:0
* ^^From \/address(_at_)host(_dot_)com(_dot_)*
{
  xFROM = "$MATCH"
  :0c:
  $DEFAULT

  :0
  * xFROM ?? ^^address(_at_)host(_dot_)com[     ]*\/[^  ].*
  { xTIME = "$MATCH" }
  :0
  * ^Subject:[  ]*\/[^  ].*
  { xSUBJ = "$MATCH" }
  # this assumes you want size of body only
  :0
  * 1^1 B ?? >1
  { xSIZE = $= }
  :0 b
  | (echo -e "New mail at: $xTIME\nFrom: address(_at_)host(_dot_)com"; \
     echo -e "Subject: $xSUBJ\nSize: $xSIZE bytes\n"; ) \
     |mail number(_at_)mobile-operator(_dot_)com
}

If it were me, I'd skip the Subject: in the body and use -s "$xSUBJ"
with the mail command.

-- 
Reply to list please, or append "8" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>