Procmail -f cron does not have a date header - how to add

This is on Fedora32 which ships without an MTA, and I don't want to add one. Procmail may be ok... So I am experimenting with using procmail directly for cron output. My crontabargs is: CRONDARGS=-m "/usr/bin/procmail -f cron" But since cronie is not putting a DATE header in its output, there is no DATE header in my local mail spool. I have dug around a bit and can't seem to find a way for procmail to add a DATE header. How may I do this? thanks

In article <eaed1094-7f89-f9ba-e5b5-8f26baec940c@htt-consult.com> you write:
I have dug around a bit and can't seem to find a way for procmail to add a DATE header.
How may I do this?
With a kludge, I'd say, something like this: :0 f ! date +"Date: %a, %d %b %Y %T %z"; cat -- Regards, John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies", Please consider the environment before reading this e-mail. https://jl.ly

On 5/10/20 11:04 PM, John Levine wrote:
In article <eaed1094-7f89-f9ba-e5b5-8f26baec940c@htt-consult.com> you write:
I have dug around a bit and can't seem to find a way for procmail to add a DATE header.
How may I do this? With a kludge, I'd say, something like this:
:0 f ! date +"Date: %a, %d %b %Y %T %z"; cat
John, And where would this go? Given that I am running procmail within cron via: CRONDARGS=-m "/usr/bin/procmail -f cron" I dug around and read a bit about formail that comes with procmail and came up with: formail -i "Date: $(date +'%a, %e %b %Y %T %z (%Z)')" >> /var/spool/mail/$USER < [cron output] I tested this by cutting out a cron output from my mbox and then inputting that file in the above. But I don't know how to put that formail command into the crondargs. Plus I don't like that I have to pipe out into my mbox...

On 5/10/20 11:13 PM, Robert Moskowitz wrote:
On 5/10/20 11:04 PM, John Levine wrote:
In article <eaed1094-7f89-f9ba-e5b5-8f26baec940c@htt-consult.com> you write:
I have dug around a bit and can't seem to find a way for procmail to add a DATE header.
How may I do this? With a kludge, I'd say, something like this:
:0 f ! date +"Date: %a, %d %b %Y %T %z"; cat
John,
And where would this go? Given that I am running procmail within cron via:
CRONDARGS=-m "/usr/bin/procmail -f cron"
I dug around and read a bit about formail that comes with procmail and came up with:
formail -i "Date: $(date +'%a, %e %b %Y %T %z (%Z)')" >> /var/spool/mail/$USER < [cron output]
I tested this by cutting out a cron output from my mbox and then inputting that file in the above.
But I don't know how to put that formail command into the crondargs. Plus I don't like that I have to pipe out into my mbox...
A refinement after reading more about formail: formail -i "Date: $(date +'%a, %e %b %Y %T %z (%Z)')" -s procmail Where stdin is the output of cron. But how to get that into the crondargs line...

In article <0a1decb2-3df5-c1aa-cf8a-3994851919b3@htt-consult.com> you write:
With a kludge, I'd say, something like this:
:0 f ! date +"Date: %a, %d %b %Y %T %z"; cat
And where would this go? Given that I am running procmail within cron via:
CRONDARGS=-m "/usr/bin/procmail -f cron"
It's a procmail recipe, it goes in .procmailrc
formail -i "Date: $(date +'%a, %e %b %Y %T %z (%Z)')" >> /var/spool/mail/$USER < [cron output]
That would do it, too.
But I don't know how to put that formail command into the crondargs. Plus I don't like that I have to pipe out into my mbox...
Put it into the .procmailrc like this: :0 f ! formail -i "Date: $(date -R)" Procmail should store the message in your mbox when it runs out of things to do in the .procmailrc so it doesn't need that >> redirect. -- Regards, John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies", Please consider the environment before reading this e-mail. https://jl.ly
participants (2)
-
John Levine
-
Robert Moskowitz