|Sat 1998-08-29 Kjetil Kjernsmo
<kjetil(_dot_)kjernsmo(_at_)astro(_dot_)uio(_dot_)no> list.procmail
|
| I feel pretty stupid asking a question like this, but I hope you can bear
| over with me and help me.
|
| I want to kill all MS Word, Excel, TNEF and similar attachments before
| they reach me. Searching the list archives, I found that pm-jamime-kill.rc
| is probably what I need, so downloaded it and unpacked it, but I must
| admit I can't quite figure out how to set it up to serve my purpose...
Just give me a call and I'll explain what you need...
(If you dind't understand it, then I have to improve documentation)
| First, it says:
| >PMSRC must point to source direcry of procmail code.
|
| Would that be the directory of the procmail program source code, or just
| the pm-code directory? (BTW, it's a typo there :-) )
Hm. Maybe you should read also
ftp://cs.uta.fi/pub/ssjaaa/pm-tips.html
Where I explain variables used:
1.6 Variables used in recipes
...
_PMSRC_ = Procmail includerc code directory, where *rc files
reside. Anywhere you want it to be: usually $HOME/pm or
$HOME/.procmail. Here you keep the procmail files, logfiles and
includerc scripts. You can also use synonym _PMDIR_.
| Then, I want the kill the attachments regardless of the mail program that
| was used to send the message. What do I do to achieve this?
| What do I set some-other-attachement-type to be?
|
| When I set JA_MIME_TYPE to kill MS stuff, could I use = "application/ms*"?
The Examples say:
o JA_MIME_TYPE will determine if the kill recipe is applied
to the message or not. Value is set for MS explorer, MS express,
Netscape and Lotus Notes messages by default.
To handle some new types not covered in the mentioned examples you
do this:
:0
* some-other-attachement-type
{
JA_MIME_TYPE = "some-new-type"
}
INCLUDERC = $PMSRC/pm-jamime-kill.rc
So, you set the JA_MIME_TYPE to match the application/ms, _WHEN_
such message arrives. If you harcode it with
JA_MIME_TYPE = "application/ms"
Then the recipe never kills anything else my MS attachement, vcards
etc slip through. That's why you dynamically set the mime type according
to incoming message. Thus I'd assume you need recipe:
myMimeTypeKillAlwaysOnSight = "application/ms"
:0
*$ $myMimeTypeKillAlwaysOnSight
{
JA_MIME_TYPE = $$myMimeTypeKillAlwaysOnSight
}
This call then knows what to look for:
INCLUDERC = $PMSRC/pm-jamime-kill.rc
| I didn't understand what JA_MIME_KILL_RE and JA_MIME_KILL2_RE does
| either... Do I need to set them to get rid of the problem, the large
| attachments?
I don't think you need to worry about that
o JA_MIME_KILL_RE, additional regexp to kill lines from the
message. Value is case sensitive awk regexp and by default matches
Lotus notes tag: name="XXX.PCX".
Mime format is like this:
--0__=cieg4oHxUNf2h3evyOXIsHTGDpFfaZilTDCFhpZSgsw
Content-type: application/octet-stream;
name="PIC10898.PCX"
Content-transfer-encoding: base64
The recipe is able to kill only according to LINES, and here the
name="PIC10898.PCX"
woudl not be killed although it belongs to mime header are. The additional
JA_MIME_KILL_RE wipes any such "ghost: lines away.
It may be possible that some messages are malformed and that they
do not contain preper "boundary" definition string in the header. I
have seen messages that have text/html attachements, but no proper
Mime headers. For those cases there is additional variable that
will kill all text up till matching line regardless of message
content.
o JA_MIME_KILL2_RE = "text/html|application/ms-tnef" Update this to
match attchements you receive. Set variable to "" if you don't
want to change the body of non-compliant MIME message.
This simply means: "If it looks like mime, although the headers claim it
isn't, go and kill anyway evething after JA_MIME_KILL2_RE".
Some MUAs send malformaed MIME messages and ifg you want to be able to
kill attachements in those messages that regexp is your only
chance.
My advice: Don't change it. The JA_MIME_TYPE is the only right
way to kill MIME. It's just a fallback, which should not even happen.
| Currently, I don't want to kill HTML attachments. I've taught my friends
| and most of the people on the lists I own not to use them, and
| occasionally I get HTML files to put on one of my servers. Are there any
| special considerations I should make, that is, is killing HTML attachments
| default behaviour of the filter?
Yes. Currently pre-configured for:
Applications for other mime attachements
Lotus Notes sends similar extra attachement and you can use this
same recipe to kill it. See example section.
Microsoft Express sends a copy of message in html format in the
attachement, you can kill that too, see example section.
Netscape's Mozilla sends a copy of message in html. See example.
Also it sends `vcards'
Openmail sends 10-20 base64 attachements WINMAIL.DAT.
You just plug
INCLUDERC = $PMSRC/pm-jamime-kill.rc
And you get all those killed. (remember to add that MS recipe below the call)
| While I'm at it, I want to save large messages to a special folder. This
| seems like a simple task, and I searched the list archives for some hints,
| and found a message with some recipe to determine size. I didn't
| understand anything of it, and since the size is logged, I figured there
| must be something simpler...?
| in any of my messages the last few days....
The size operators in procmail are "<" and ">". Examples in
11.5 Counting lines in a message (Adding Lines: header)
11.6 Determining if body is longer than header
The best advice can give you; grab the pm-tips.txt and print it
to printed 4 pages on A4 (to shrink it). Go home on weekend
and concentrate on the document and try to absorb all you can.
Then look at the recipes with new pair of procmail eyes :-)
jari