procmail
[Top] [All Lists]

Re: Date in address of outgoing email?

2000-12-23 21:16:29
On 23 Dec, Gun Wear wrote:
| I am trying to include the date in a YYYYMMDD format on outgoing email using
| the command line function "date +%Y%m%d". Here is what I have tried so far.
| 
| filename = $HOME/procmail/today-k12news.txt
| thedate = "date +%Y%m%d"
| 
| :0 bw : $filename.LOCKEXT
| *^From:(_dot_)*k12news(_at_)k12(_dot_)com*
| *^Subject:.K12 News
|| perl -p -e 's/\.{10,}.*?\.{10,}//sg' | \
| tee $filename | \
| mail -s "K12 News" 
distro-list$thedate(_at_)chandler(_dot_)k12(_dot_)az(_dot_)us -f
| basilr(_at_)chandler(_dot_)k12(_dot_)az(_dot_)us
| 
| 
| Any hints?

Not many without more clues.

One obvious thing is the assignment to "thedate" should be:
thedate=`date +%Y%m%d`. You're just assigning a string the way you're
doing it. The backticks expand the output of the enclosed command and
assign that output to the variable.

Maybe it's me, but I can't make heads or tails of the the rest of it.
I would probably use a filter recipe with formail to change the
Subject:, and a clone (copy) recipe to save to $filename (if that's the
purpose behind tee), and whatever it is you're doing with perl would
probably also be in a filter recipe.

Finally, the pipe to mail makes no sense to me. Is
"distro-list$thedate(_at_)chandler(_dot_)k12(_dot_)az(_dot_)us" going to 
somehow expand to
multiple recipients?  And does it change at midnight each day? And what
is the "-f" part? That's for reading, not sending mail. Is there some
reason this isn't just being forwarded by way of procmail's '!' action?

Maybe something like this (untested) will get you started:

filename=$HOME/procmail/today-k12news.txt
thedate=`date +%Y%m%d`

:0 
*^From:(_dot_)*k12news(_at_)k12(_dot_)com*
*^Subject:.K12 News    # or do you mean: .*K12 News?
{
  :0 fbw 
  | perl -p -e 's/\.{10,}.*?\.{10,}//sg' 
  :0 fhw
  | formail -I "Subject: K12 News"   # or maybe -i instead
  :0 c:
  $filename
  :0
  ! wherever_it_is_you're_trying_to_send_this
}

But, of course, not understanding what you're trying to do may mean I've
missed the point entirely. That seems likely since your "thedate"
variable is never used, and it was the subject of your query. I can only
guess that it's supposed to end up somewhere after the '!' action, but
have no idea how or why.



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