MYplugin example for IMS/Mfilter mail servers

Q&A's, tips, howto's
Locked
CaveGuy
Posts: 112
Joined: Sun Oct 13, 2002 3:00 pm
Location: Columbus Ohio
Contact:

MYplugin example for IMS/Mfilter mail servers

Post by CaveGuy »

In the NT world there is a free mail server called IMS that works with a program Mfilter that uses plugins to
filter e-mail. NewLISP provides an alternate development platform for Mfilter plugins.
I have successfully (linked MYplugin.exe and run it as a Mfilter plugin on an IMS server. I posted this example in the IMS-Users mailing list and there may be a few people come by here to say howdy from that group.

# MYpulgin.LSP for NewLISP & Mfilter for IMS
# Contributed by Bob aka Lord High Fixer (bob@bradlee.org)
#
# This function opens MSG file specified in arg[2] and re-writes it
# to the Working Path specified in arg[1] appending the contents of
# the RCP file arg[3] as X-HEADER lines in the NEW file
#
# Replace the current MSG files path with my working path in arg(1)
# '(append (nth 1 arg-lst) (last (parse (nth 2 arg-lst) "\\")))
#
(set 'arg-lst (main-args) ; save args from calling program
'fh-h (open (nth 3 arg-lst) "read") ; RCP file for X-Header info
'fh-m (open (nth 2 arg-lst) "read") ; MSG file
; Replace the current MSG file path with the working path in arg(1) and open it.
'fh-w (open (append (nth 1 arg-lst) (last (parse (nth 2 arg-lst) "\\"))) "write")
'do-header-flag true) ; set header flag
(while (read-line fh-m) ; walk through the message
(if do-header-flag
(begin ; do header on first pass .. else: loop through message body
(set 'do-header-flag nil) ; turn flag off, were not comming back
(while (!= (set 'text-line (read-line fh-m)) "") ; loop through header
(write-line text-line fh-w))
(while (set 'text-line (read-line fh-h)) ; add RCP info as X-headers
(write-line (append "X-" text-line) fh-w))
(write-line "" fh-w) ) ; add the header break, then end the (if (begin
(write-line (current-line) fh-w))) ; else the header is done, loop through message
(close fh-m) ; close files
(close fh-h)
(close fh-w)
#
# Comment and Uncomment these lines at your own risk!!!!
#
# the following line will copy the modified "MSG" file back over the top of the origional.
; (copy-file (append (nth 1 arg-lst) (last (parse (nth 2 arg-lst) "\\"))) (nth 2 arg-lst))
#
# the following kills off the working file. Comment it out if you want to keep the file.
(delete-file (append (nth 1 arg-lst) (last (parse (nth 2 arg-lst) "\\"))))
#
(exit 1) ; and we are out of here ....
# EOF

Thats it, Linked to the NewLISP runtime enviroment results in a 165K MYplugin.exe that works !!!
Bob the Caveguy aka Lord High Fixer.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

I have been without electricity since Thursday afternoon, it just came back, but have to take care of other stuff at the moment (like the rotten food in the refrigerator etc.) will be there by tomorrow.

Lutz

CaveGuy
Posts: 112
Joined: Sun Oct 13, 2002 3:00 pm
Location: Columbus Ohio
Contact:

Lack of Electromotive force :(

Post by CaveGuy »

Came home from vacation once and found the defrost heater elements in the freeser had stuck on for about two weeks and everything had been slow cooked in both sides of a sides by side. It was not a nice site or smell.
Good luck and welcome back to the 21 century. Never had 2+ days without power, but then I do have an old 1500w backup generator for the house and several hours of battery backup. Only used the generator for one night to keep the fridge and (gas) heat circulating during a winter ice storm. I hear 80% of ansterdam was out of power this week and at least one data center had been on generator all week and was running low on fuel.

Good luck...
Bob the Caveguy aka Lord High Fixer.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

MYplugin example for IMS/Mfilter mail servers

Post by Lutz »

Thanks for the mail fileter example. I am not a mail server expert, but it looks to me that that code is pretty much applicable to most mailservers as the message files honor some kind of RFC standard.

About electricity: I live in Sillicon Valley, but a fiew miles out of Los Gatos in the Santa Cruz mountains. With the first winter storm a lot of powerlines came down and it took them 3 days to fix it. I should get one of those generators too. I think they are under $1000 for 5KW or so including a transfer switch. The question is, do they generate sinus wave AC suitable for the everage PC/Monitor power supply or some square wave ruining electronics?


Lutz

Ryon
Posts: 248
Joined: Thu Sep 26, 2002 12:57 am

OT

Post by Ryon »

As long as we are wandering off topic, have you been to the Mystery Spot, Lutz? http://www.mysteryspot.com/ The "shack" was fairly easy to figure out, as was the plank with the ball rolling "uphill", but I'm still puzzled about how you can have two people of the same height facing each other one way, and different heights facing the other.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

It's about 10 miles away here in the Sta Cruz Mountains, but I have never been there. It's all psychology, playing tricks with how human vision/perception works.

CaveGuy
Posts: 112
Joined: Sun Oct 13, 2002 3:00 pm
Location: Columbus Ohio
Contact:

Post by CaveGuy »

Your storm got here last night. The office lost power
at 5:30 pm and got it back at 7:30 am.
I have an 25+ year old sears generator that was my dads, it only has run run 4 or 5 times in 25+ years here at the house. Our power here at the house was just fine.

The Data Center has a huge generator of its own, they tell me it has over a weeks of fuel at full load, and
should make it close to a month at our reduced load.

We took over the old Winstar Central Office, that previously served Central Ohio, when they bellied up.
Lucent came in and pulled the ESS5 Switch and all the wireless equiptment, but left the Redundant power feeds, backup generator, Lots of big batteries, fire portection and a lot of exsisting fiber running to every major exchange point and CO in town :)
Bob the Caveguy aka Lord High Fixer.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Wow, quite a setup! perhaps I should move to Ohio, here only 10 miles from Sillicon Valley electricity goes away at least once a year. Two years ago, during the CA energy crisis, it was so bad they would switch off whole areas, because there wasn't enough juice for all of us on hot days.

Lutz

CaveGuy
Posts: 112
Joined: Sun Oct 13, 2002 3:00 pm
Location: Columbus Ohio
Contact:

Post by CaveGuy »

If you ever need a fat pipe to the internet hosted in a
secure enviroment owned and operated by geeks :)
It is now controled by those of us that built it and run it. All the big iron was purchased used on e-bay, and at the firesales of several the fadeing .coms :)
Bob the Caveguy aka Lord High Fixer.

Locked