Short: Scan mail inbox for messages to extract Author: gragg@inetworld.net (Brian Gragg) Uploader: gragg inetworld net (Brian Gragg) Type: comm/mail Architecture: m68k-amigaos A simple program which when called, will scan a file (presumably your mail inbox) and will extract messages you want saved to a different file. For instance, my wife subscribes to a mailing list that gets 60 messages a day. I end up searching through all 61 messages we've recieved, looking for the one to me. So I wrote this program. Now after recieving mail, I run mailextract. It searches for all messages with a To: or Cc: line with the mailing list name in it. Those messages are moved from the inbox to a file where all her incoming mailing list stuff is. You can have it search for a bunch of different header strings and save to as many files (I think the limit is 20). All messages which don't match any string, are left in the inbox (unless you search on #? as one of the strings). Searching is case insensative. This program is very similar to one on aminet, I don't remember the name. The difference is that this one is called when you want to sort your inbox (like right after you run getmail) as opposed to the other which was a commodity that was always running. Also, this one has source code so you can modify it to do just what you want. This code is public domain. If you use it, I'd like to know and perhaps receive credit, but since it's public domain you don't really have to. It's a thank you to all the amiga programmers out there. I wrote it using an Amiga 3000 running WB3.1. So I don't know if it has any specific code for any other machines, but like I said, source is included so you can recompile it if you want. How To Use It: ============= First create a file (I call it .merc) which holds the list of search strings and files to save to. The format is ; comment lines search pattern filename search pattern filename ..and so on. The search string uses standard amigados search patterns. Okay, now just type mailextract inboxfile mercfile and the inboxfile will be searched and the mercfile will be used to determine which messages to extract. So to search for the To: or Cc: header containing JunkMail@whoever.com and save those to the file uumail:whoever, you'd use a .merc file like this ;.merc file ??:#?JunkMail@whoever.com#? uumail:whoever or ;.merc file To:#?JunkMail@whoever.com#? uumail:whoever Cc:#?JunkMail@whoever.com#? uumail:whoever It's pretty simple. How I Use It: ============ I run an arexx script every time I log onto the network or want my mail read. It looks like this: address command /* get mail, this is as normal */ 'getmail MAIL uumail:gragg USER gragg PASS ***** HOME uulib: POPHOST smtp.inetworld.net DELETE' /* now run the mailextract */ 'c:mailextract uumail:gragg uulib:.merc >t:me.out' /* since I sent the output to a file, I can open a window on workbench and ** display the number of messages moved to each file and the number left ** in the inbox. Also, it speaks the output using the say program. */ IF Open(meout,"T:me.out",'r') THEN DO CALL Close('STDOUT') IF Open("STDOUT","con:200/150/180/120/AnnounceMail/Auto/Close","w") THEN DO CALL Pragma("*","STDOUT") DO WHILE ~EOF(meout) line = ReadLn(meout) SAY line IF Length(line)>1 THEN 'sys:utilities/SAY' line END CALL Close(meout) CALL Delete("T:me.out") CALL Delay(100) CALL Close("STDOUT") CALL Pragma("*") END CALL Open("STDOUT","*","w") END