10

Use :0c for forwarding a copy of a message :0c ! myusername@gmail.com c flag documentation: c Generate a carbon copy of this mail. This only makes sense on delivering recipes. The only non-delivering recipe this flag has an effect on is on a nesting block, in order to generate a carbon copy this will clone the running ...


7

I could not find a way to preserve or re-instate the 'unread' flag on the server. In the end, I switched to using getmail, a more modern alternative to fetchmail that's written in Python. Unlike fetchmail, getmail retrieves messages based upon the server's message id rather than the message 'unread' flag. This is the getmail configuration file I created ...


7

You need both H and B if you want to match headers and body. See the Procmail Tips page, full of useful examples. Try :0 HB * ^From:.*root@example.com * ^Subject:.*fixed string in the subject line * fixed string in the body /dev/null (note, the above doc refers to a bug in version 3.22 whereby once HB is used further uses of just B will still look through ...


7

If your Procmail or the receiving MTA is configured to put in a From_ line before the message proper, this pseudo-header generally already contains the date. You'll need to parse it, which is a drag, so unless this is a system where you really need to optimize for perfomance (hundreds of matches per second on this condition?) the absolutely easiest solution ...


5

Remove f flag from the recipe without adding w or W flags. f flags marks filter. It makes procmail rewrite the message for next procmail rules in the procmail script. Procmail has to wait for the filter command to finish. f flag description in procmail mini-faq Q: How can I change the contents of a message but otherwise proceed through my .procmailrc ...


4

To run the mail through a script you can modify your rule like so using 2 rules: :0: c * ^X-Spam-Status: Yes Spam/ :0: fw * ^X-Spam-Status: Yes | /usr/bin/python /work/scripts/process_mail.bash Your program will receive the mail on STDIN. You'll have to 'echo' the possibly transformed mail on STDOUT. fw means: f Consider the pipe as a filter. w Wait for ...


3

Just Do It. dummyvalue=`sleep 10` If you want it as part of a recipe, you can easily run any command synchronously: :0w * ? sleep 10 { } (I added the w flag for good measure.) Much larger values are possible, though if you exceed the default value of TIMEOUT, Procmail will abort the sleep. Though you can bump the value of TIMEOUT to a larger value (the ...


3

What you have should work, provided the file $HOME/reply.html is correctly formatted. Alas, as per your description, it isn't. Incidentally, I would factor out as much as possible of the static headers into this file, and only use formail to prepend headers which cannot be calculated in advance. That leaves you with just :0 | (formail -rA "$XLOOP" | grep ...


3

Your /etc/postfix/main.cf file doesn't mention procmail anywhere. This is the problem, AFAIK. In my case, I have: mailbox_command = procmail -a "$EXTENSION" and my procmail config file is in ~user/.procmailrc. However this is a real user on the machine. It seems that you're using virtual transport, in which case I suppose that you should use something ...


3

DEFAULT is the path to the default mailbox file. (It can be a directory with maildir, but it's still one mailbox, not something that's treated as a directory with subdirectories). You want MAILDIR. Current directory while procmail is executing (that means that all paths are relative to $MAILDIR).


3

man procmail states: Denying special privileges for "x" Procmail will not take on the identity that comes with the rcfile because a security violation was found (e.g. -p or variable assignments on the command line) or procmail had insufficient privileges to do so. I the presented case the error message is caused by variable assignments on the ...


3

This invocation is incorrect, unless you're somehow trying to run a command whose name is the output of footools.sh: :0 | `/home/foouser/scripts/footool/footool.sh` This is normal syntax: :0 | /home/foouser/scripts/footool/footools.sh procmail will execute footools.sh and pass the email to the script on stdin. No need for $SHELLMETAS or special ...


3

Procmail makes great efforts to assure that mail is not lost even if delivery fails. According to man procmail, email will be bounced back to sender as a last resort: ORGMAIL Usually the system mailbox (ORiGinal MAIL‐ box). If, for some obscure reason (like `filesystem full') the mail could not be ...


3

Is there any reason why killall procmail doesn't work? If it's running as another user, try sudo killall procmail If procmail keeps on being restarted, that is because your Mail Transfer Agent (MTA - e.g. postfix or exim) keeps on invoking it to deliver mail to user inboxes. That's procmail's job - it's a Mail Delivery Agent (MDA). Some have suggested ...


3

:0 * ^From:.*root@example.com * ^Subject:.*fixed string in the subject line * B ?? fixed string in the body /dev/null man procmailrc variablename ?? Match the remainder of this condition against the value of this environment variable (which cannot be a pseudo variable). A special case is if variablename ...


3

Your DEFAULT=inbox/ says that mail should be delivered to a Maildir mailbox (with subdirectories cur, new and tmp). This mailbox is located in $HOME/Mail/. according to the MAILDIR variable. To deliver to an MH mailbox instead, you should set DEFAULT to inbox/. (note the dot at the end). MAILDIR can be set to $HOME/Mail. In short: The final mailbox path ...


3

The formail -s method is documented with a demo script in the procmail man page; look for this phrase: Procmail can also be invoked to postprocess an already filled system mailbox. You would also find this in http://www.iki.fi/era/procmail/mini-faq.html#split If your mailbox is not a Berkeley mbox single file, chances are you have a directory where ...


3

Answering each of your questions: You can call out to external commands from within a recipe, so you can do something like this to define variable TODAY: TODAY=`date +%Y%m%d` You can then refer to it in your recipes: ripmime --overwrite --no-nameless -i - -d /dir/to/save/attachment/$TODAY_report_xlsx If you need to determine the filename dynamically, ...


2

unfortunately, U'll probably have to re-write munpack to add the capability of unpacking multiple files. according to a README that came with v1.5 source, "[t]here must be exactly one message per file. Munpack cannot deal with multiple messages in a single file, to decode things correctly it must know when one message ends and the next one begins." i don'...


2

In mutt, you can type v, and then select the alternative you want to display. You can also change the content-type of a part with Ctrl-E. As a more generic approach, you could use mutt's display_filter setting: set display_filter=/path/to/mutt-filter With mutt-filter being something like: #! /usr/bin/awk -f BEGIN { cmd="echo '[automatically converted ...


2

The top level of procmail recipes are reserved for assignment of procmail variables. Add the following to the top of your procmail recipe. MAILDIR="$HOME/Maildir/" When defining where the mail should be delivered, you have defined Xyz as a file, not a directory. It should instead read: :0: * ^TO_myemailaddress@domain.com Xyz/ procmail is extremely ...


2

If you are using mutt, you can pipe the email through procmail and also delete the original from your inbox with a key command something like this: muttrc: macro index y '<enter-command>unset wait_key<enter><tag-prefix><pipe-entry>/usr/bin/procmail /home/user/.procmailrc<enter><tag-prefix><delete-message><enter-...


2

Ther eisn't really anything out of the box that I'm aware of with fetchmail but you could easily construct something yourself like so. If you had a start) section to your /etc/init.d/fetchmail service: start) # Start daemons. echo -n "Starting fetchmail: " update_boot_stage 'Starting email fetching service' conffile=/etc/...


2

In conventional mbox systems, the first message in /var/mail/you is -- by definition -- unread and the oldest available. formail -zxSubject: -1 -s </var/mail/you To extract the message to a file (so you can conveniently forward just that message) and then extract the Subject: header, try something like tmp=$(maketemp -t findoldestunread.XXXXXXXX) || ...


2

Here's a slight adaptation of @slm's answer. You should not use locking with Maildir, and the flags and the lock colon were the wrong way around. (You would effectively create a lock file named c, rather than clone the message, so the second action would never fire.) The f flag seems out of place. I reversed the order of the actions; while it makes sense ...


2

You can do something like this for all rules that sort messages to list folders: :0 * ^List-Id:... { :0 c: somefolder :0 fw | formail -a X-Chad-Loop: Chad was here } Then just before the end: :0 * ^X-Chad-Loop:\ Chad\ was\ here { :0 /dev/null HOST } I think this will also log the delivery to /dev/null. If you don't like ...


2

postfix executes mailbox_command with uid of the recipient. It should make -d ${USER} unnecessary. http://www.postfix.org/postconf.5.html#mailbox_command mailbox_command (default: empty) Optional external command that the local(8) delivery agent should use for mailbox delivery. The command is run with the user ID and the primary group ID privileges of ...


2

Assuming that your mailbox file is in the mbox format, you can use the formail utility that comes with procmail to run a command on each mail, with the -s option to tell it that the input is a mailbox and not just a single mail. That command can be procmail if you want to apply your procmail rules, or it can be anything else that receives the mail on ...


2

The override persists only for the condition in which it is defined. Here's a slightly-altered experiment to demonstrate: pm-test.rc :0 H * ^To:.*recipient * B ?? tribbles * space mailbox test-mail.txt From: space-alert@storage.com To: recipient@local.net Your storage locker is overflowing with tribbles. Please clean it out. Note that the word "space"...


2

Looks like you're talking about RFC 2047: MIME encoding for email headers. Further RFCs have since then augmented this RFC to allow more character sets and to optionally include a language specification. Because the initial email and MIME specifications included the assumption that headers would only contain strict US-ASCII, the header encoding is ...


Only top voted, non community-wiki answers of a minimum length are eligible