Wasup, Thanks for the offer, but as long as this works for you and you learn from it, I'm happy. I also remember I was where you are, a long time ago and there were some that helped and other that didn't (or were rude). I'm just returning the favour in helping you - that's what the Internet community is all about. Maybe once you've learned more you will help someone else. That's full circle.
Did the script do what you want? Rob :-) _________________________________________________ Note To Self: Remember to put something witty here later... -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of waassssuu pppp Sent: Wednesday, January 24, 2007 2:32 AM To: xmail@xmailserver.org Subject: [xmail] Re: Forwarding High Priority emails Rob, Its ok to rant and be harsh, I dont blame you. I know to you this seemed like a simple task and I might could have possibly figured it out on my own. Sometimes though I am unclear on things and I am not a script king, Im sorry for that. I was hung up on :HighImportance exit 0 and adding %FILE% to the cmd script I appreciate all of your time and work and want to give you some compinsation for your time. Do you have paypal? On 1/22/07, Rob Arends <[EMAIL PROTECTED]> wrote: > > > Wasup, you are missing it altogether. > > Yes Xmail creates the filenames you listed (the names are a combination > of: > "seconds since 1/1/1970 00:00" DOT "ProcessID" DOT "Hex counter of > messages > since xmail started" DOT "server name") > > Aside from that. > You need to think of the path ONE email will take through Xmail. > 1. SMTP session starts > 2. HELO (or EHLO) smtp command is received > 3. MAIL FROM smtp command is received > 4. RCPT TO smtp command is received > 5. DATA smtp command is received > 6. The email, usually MIME encoded is received > 7. . (that's a dot on newline) is received > 8. SMTP session ends > 9. Xmail delivers the email > > In the case of a local recipient > 10. The local user delivery process looks for > /domains/mydomain.com/wasup/mailproc.tab > 11. If it does not exist, it assumes "mailbox" directive > 12. If it is found it delivers according to the contents > 13. In your case: > 14. "mailbox"[newline] > 15. "external"[tab]"0"[tab]"20"[tab]"cmd /c > d:\xmail\xmail_filters\test.cmd"[tab]"@@FILE"[newline] > 16. "redirect"[tab]"[EMAIL PROTECTED]"[newline] > > So, at 4,5,7,8 various filters can be run; these are the > in/out/pre-data/post-data/post-rcpt filters. > > You are using the processing at 13 to control the delivery of a given > email > as it is delivered. > Your premise is that the mail is stored somewhere and your script needs to > search through each one to process it. > This is an incorrect premise. > The reason there is a @@FILE macro is so that the script will know which > file (email) to process, so it should be ONE file, not *.Many files. > If you were to receive 3 emails at the same time, then you will have 3 CMD > process running concurrently, each running the same script but with > different @@FILE macro values. > > Are we clear so far? > > Ok, so at 14, THIS EMAIL is delivered to the user's mailbox > At 15 the external program/script is run. This script determines if the > email was high priority and returns errorcode(RC) 0 or 16 to xmail. > If the RC was 0, then xmail processes #16. If the RC was 16, then further > processing ceases. > > This is how we get the forward to yahoo.com decision. > > Are we clear so far? > > > START ---PLEASE USE THIS d:\xmail\xmail_filters\hi-pri.cmd --- > > @echo off > REM Written by Rob Arends > REM > REM Script to return 16 to Xmail if the email is NOT of high Importance. > setlocal > set FILE=%1 > > grep -Pqi "^X-Priority:\s*1\s" %FILE% > set XPriHigh=%ERRORLEVEL% > > grep -Pqi "^X-MSMail-Priority:\s*High" %FILE% > set XMSPriHigh=%ERRORLEVEL% > > grep -Pqi "^Importance:\s*High" %FILE% > set ImportHigh=%ERRORLEVEL% > > if "%XPriHigh%"=="0" goto HighImportance > if "%XMSPriHigh%"=="0" goto HighImportance > if "%ImportHigh%"=="0" goto HighImportance > > Rem Defaults to not HighImportance > exit 16 > > :HighImportance > exit 0 > > :EOF > END ---PLEASE USE THIS d:\xmail\xmail_filters\hi-pri.cmd --- > > > > START ---PLEASE USE THIS mailproc.tab in the user's folder --- > > "mailbox"[newline] > "external"[tab]"0"[tab]"20"[tab]"cmd /c > d:\xmail\xmail_filters\hi-pri.cmd"[tab]"@@FILE"[newline] > "redirect"[tab]"[EMAIL PROTECTED]"[newline] > > END ---PLEASE USE THIS mailproc.tab --- > --- NOTE THERE ARE ONLY 3 LINES ABOVE--- > > <Soapbox> > I'm so disappointed I've had to spoon this to you. > There has been enough info given prior to now, plus a bit of research on > your part and you would have it licked. > This list isn't a hand holding group. > What ever happened to a little 'trial and error' with your script writing > to > 'see what happened'? > In the early parts of this thread I pointed you to CMD commands "help for" > and "help set". > (Also see "Help" / "Help if" /etc.) > With these and xmail's readme doc, you could have learned and solved it as > you went. > There is a history on this list of help being given graciously when there > is > apparent contribution from the person asking for help. > I suppose that's my gripe, I haven't seen your contribution.!! > > Now you have a solution and you don't know why or how it works. > Hopefully this email does help you understand the process a little. > I'm wondering why you're running xmail server if you have seemingly zero > point one (0.1) script knowledge and your problem solving skills seem to > be > non-existent and you want others in this world to solve all your problems > for you. > <...let's go of hand> <shudders and comes back to reality> > </Soapbox> > > Sorry if I seem a little harsh, your solution is a cut/paste away (see > above > script & tab-file). > > Rob :-) > > _________________________________________________ > Note To Self: Remember to put something witty here later... > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On > Behalf Of waassssuu pppp > Sent: Tuesday, January 23, 2007 2:02 AM > To: xmail@xmailserver.org > Subject: [xmail] Re: Forwarding High Priority emails > > Well maybe you are not understanding me or I am not clear on what to do > yet. > > I dont think I can tell the script to look at any one certain incoming > email > to see if its important or not. Xmail makes them random names with the > computer name as an extension like this. > 1157635092733.4380.4965.SERVER1 > 1157635321426.4380.4967.SERVER1 > 1157635321549.4380.4968.SERVER1 > 1157635321762.4380.4969.SERVER1 > 1157635322797.4380.496a.SERVER1 > 1157635323604.4380.496b.SERVER1 > 1157635323945.4380.496c.SERVER1 > 1158179359378.3744.192.SERVER1 > 1158251400887.4484.29f.SERVER1 > 1158265981777.4140.2eb.SERVER1 > 1158265981841.4140.2ec.SERVER1 > > Thats why I chose *.server1. > So far so good with the script I have. I have a test folder with many > emails > in it like I listed above and some are hi pri. > I run the script and it detects like 5 of my test hi priority mails, so I > just need to know what add to the script to tell it to send the mails > since > they were found... I think.... > > Thats why in my script under :FOUND I was wondering what to put next cause > the script so far just detects there is hi pris and doesnt have further > instructions. > > Or I am missing it all together. > > My goal is simple. When emails come to [EMAIL PROTECTED] from anyone, and > they are marked High Priority, then they are then forwarded to > [EMAIL PROTECTED] > > > On 1/20/07, Rob Arends <[EMAIL PROTECTED]> wrote: > > > > > > Wasup, I've been away for a few day break. > > > > The problem is that you're passing *.server1 to the grep. > > What is this file?? > > > > If you look at your (filter) tab file, you'll see in part: > > "....test.cmd" "@@FILE" > > %0 %1 > > CMD file access your command line parameters is via the above shown "%n" > > variables. > > > > So, your test.cmd should look like this: > > > > @echo off > > REM Written by Rob Arends > > REM > > REM Script to return 16 to Xmail if the email is NOT of high Importance. > > setlocal > > grep -Pqi "^X-Priority:\s*1\s" %1 > > set XPriHigh=%ERRORLEVEL% > > > > grep -Pqi "^X-MSMail-Priority:\s*High" %1 > > set XMSPriHigh=%ERRORLEVEL% > > > > grep -Pqi "^Importance:\s*High" %1 > > set ImportHigh=%ERRORLEVEL% > > > > if "%XPriHigh%"=="0" goto HighImportance > > if "%XMSPriHigh%"=="0" goto HighImportance > > if "%ImportHigh%"=="0" goto HighImportance > > > > Rem Defaults to not HighImportance > > echo file %1 NOT is important >>mylogfile.txt > > exit 16 > > > > :HighImportance > > echo file %1 is important >>mylogfile.txt > > exit 0 > > > > :EOF > > > > > > Note that you are trying to access only one file in this instance of the > > filter execution. > > You wont want to access any wildcard files like "*.server1". > > > > When you are happy with the results, you can take out the "echo file > ..." > > lines. > > > > Xmail provides filenames in the format \\?\filename.txt > > So if grep does not like these names, you may need to do this after the > > setlocal: > > > > ---------- > > set FILE=%1 > > if "%FILE:~0,4%"=="\\?\" set FILE=%FILE:~4% > > ---------- > > > > Then use %FILE% instead of each %1 in the GREPs. > > > > Also I hope your user's mailproc.tab file looks like this: > > "mailbox"[newline] > > "external"[tab]"0"[tab]"20"[tab]"cmd /c > > d:\xmail\xmail_filters\test.cmd"[tab]"@@FILE"[newline] > > "redirect"[tab]"[EMAIL PROTECTED]"[newline] > > > > Note the [newline]s > > > > Rob :-) > > > > _________________________________________________ > > Note To Self: Remember to put something witty here later... > > > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > On > > Behalf Of waassssuu pppp > > Sent: Tuesday, January 16, 2007 8:45 AM > > To: xmail@xmailserver.org > > Subject: [xmail] Re: Forwarding High Priority emails > > > > I have got myself all confused now. > > > > I decided that what I should do is just make the server check the emails > > to > > see if they are HIGH PRIORITY and if they are then send it to the > > Blackberry > > device. > > > > I can inform users that if they want a offic user to receive the email > on > > said users blackberry then send the email HIGH PRI. > > > > No need to keep a list of people now. > > > > I am confused on how to make it work, I am missing one thing somewhere. > > > > Here is the batch file to use > > > > @echo off > > setlocal > > grep -Pqi "^X-Priority:\s*1\s" *.server1 > > set XPriHigh=%ERRORLEVEL% > > > > grep -Pqi "^X-MSMail-Priority:\s*High" *.server1 > > set XMSPriHigh=%ERRORLEVEL% > > > > grep -Pqi "^Importance:\s*High" *.server1 > > set ImportHigh=%ERRORLEVEL% > > > > if "%XPriHigh%"=="0" goto Found > > if "%XMSPriHigh%"=="0" goto Found > > if "%ImportHigh%"=="0" goto Found > > > > goto EOF > > > > :Found > > NOT SURE WHAT TO PUT HERE, I have had things here and nothing worked. > > Nothing was right im sure. > > > > :EOF > > > > My Tab looks like this. > > "mailbox" > > "external"[tab]"0"[tab]"20"[tab]"cmd /c > > d:\xmail\xmail_filters\test.cmd"[tab]"@@FILE" > > "redirect"[tab]"[EMAIL PROTECTED]" [newline] > > > > > > It should only redirect if the message is a high pri message. I chose > > @@file > > cause I use xmail version 1.21 on windows 2000 server and I felt like it > > had > > to look at the file in order to process. > > > > I am unsure if I am doing this correct and if I am, what to put in the > > batch > > file after it reads the file. > > > > Currently, if I send an email to my test user account it redirects to > the > > yahoo account no matter what its priority, so I do not have something > > right > > in the batch file I think, cause it just proceeding. > > > > > > On 1/8/07, Ivo Smits <[EMAIL PROTECTED]> wrote: > > > > > > > > > I would check the Importance header first, since it should always be > > > there. > > > The others are optional. > > > I would also immediately check the %ERRORLEVEL% and jump, to save some > > > grep/processing time. > > > > > > I guess I only looked at sample.cmd and skipped sample2.cmd ^_^ > > > Thank you for telling me about %ERRORLEVEL% :P > > > > > > By the way, am I the only one having the problem that mail from my > > server > > > to > > > hotmail/gmail immediately goes into the Junk folder? > > > I publish (CORRECT!) SPF records. > > > My Reverse address looks dynamic, but it's semi-static =) (I keep it > as > > > long > > > as my modem isn't offline for more than a week or so). > > > What's best? Put my (dynamic-looking) reverse address as the HELO > > domain, > > > or > > > should I use my primary domain name (UFO-Net.nl)? > > > > > > ----- Original Message ----- > > > From: "Rob Arends" <[EMAIL PROTECTED]> > > > To: <xmail@xmailserver.org> > > > Sent: Monday, January 08, 2007 1:08 PM > > > Subject: [xmail] Re: Forwarding High Priority emails > > > > > > > > > > > > > > Ivo, > > > > > > > >> I thought everything that started with X- is an optional/unofficial > > > > header. > > > >> So "Importance: High" would be an/the official header and should > > always > > > >> be > > > > > > > > > > > > It is, but it can't hurt to check the others too. > > > > > > > >> And it may be better to check only the 'match found'/'success' > > > >> errorlevel, > > > > > > > >> and skip on EVERYTHING else, to prevent strange behaviour due to > grep > > > >> failure... > > > > > > > > My sample2.cmd script does do that, in that if errorlevel is NOT > "0", > > > then > > > > it drops through to "goto EOF", effectively making the script only > do > > > the > > > > 'important' thing if a match. > > > > Note GREP.EXE returns 0 on match, 1 on no match and 2 on error - as > > per > > > > grep > > > > --help > > > > > > > >> Note the ^ in the Grep line, it is to make sure the line begins > with > > > >> Importance, so it can't be matched in the subject or message body. > > > >> %ERRORLEVEL% is new to me, I only really used batch files on MS-DOS > 6 > > > ;) > > > > > > > > I agree with the ^ anchor. > > > > So I'd use these lines: > > > > ::> grep -Pqi "^X-Priority:\s*1\s" test1.txt > > > > ::> grep -Pqi "^X-MSMail-Priority:\s*High" test1.txt > > > > ::> grep -Pqi "^Importance:\s*High" test1.txt > > > > > > > > %ERRORLEVEL% is a NT4/2000/2003 "CMD" thing, > > > > as opposed to a DOS/w95/98/me "BAT" thing. > > > > > > > > Rob :-) > > > > > > > > _________________________________________________ > > > > Note To Self: Remember to put something witty here later... > > > > > > > > > > > > -----Original Message----- > > > > From: [EMAIL PROTECTED] [mailto: > > [EMAIL PROTECTED] > > > > On > > > > Behalf Of Ivo Smits > > > > Sent: Monday, January 08, 2007 1:13 AM > > > > To: xmail@xmailserver.org > > > > Subject: [xmail] Re: Forwarding High Priority emails > > > > > > > > > > > > I thought everything that started with X- is an optional/unofficial > > > > header. > > > > So "Importance: High" would be an/the official header and should > > always > > > be > > > > there is the client really wants his mail to be delivered at a high > > > > priority. > > > > And it may be better to check only the 'match found'/'success' > > > errorlevel, > > > > and skip on EVERYTHING else, to prevent strange behaviour due to > grep > > > > failure... > > > > > > > > ----------------------------------- > > > > grep "^Importance: High" test2.txt > > > > if "%ERRORLEVEL%"=="0" goto Found > > > > goto NotFound > > > > > > > > Found: > > > > echo HIGH PRIORITY... deliver to portable device... > > > > > > > > NotFound: > > > > REM Do nothing, just exit > > > > ----------------------------------- > > > > > > > > Note the ^ in the Grep line, it is to make sure the line begins with > > > > Importance, so it can't be matched in the subject or message body. > > > > %ERRORLEVEL% is new to me, I only really used batch files on MS-DOS > 6 > > ;) > > > > > > > > Ivo > > > > > > > > ----- Original Message ----- > > > > From: "Rob Arends" <[EMAIL PROTECTED]> > > > > To: <xmail@xmailserver.org> > > > > Sent: Sunday, January 07, 2007 2:57 AM > > > > Subject: [xmail] Re: Forwarding High Priority emails > > > > > > > > > > > >> > > > >> Ivo, On Winxp you are better to use %ERRORLEVEL% - it is easier to > > work > > > >> with. However in concept you are correct. > > > >> > > > >> Wasup, > > > >> First I used grep --help and checked at the bottom for the > ERRORLEVEL > > > >> codes. > > > >> An initial test was done as follows: > > > >> > > > >> File:: test1.txt > > > >> ---------------- > > > >> X-Priority: 1 (Highest) > > > >> X-MSMail-Priority: High > > > >> X-Mailer: Microsoft Office Outlook, Build 11.0.6353 > > > >> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 > > > >> Thread-Index: AccwCu5xTRFeu0UMTCOG2y+Fa96J0Q== > > > >> Importance: High > > > >> ---------------- > > > >> > > > >> File:: test2.txt > > > >> ---------------- > > > >> X-Mailer: Microsoft Office Outlook, Build 11.0.6353 > > > >> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 > > > >> Thread-Index: AccwCu5xTRFeu0UMTCOG2y+Fa96J0Q== > > > >> ---------------- > > > >> > > > >> File:: sample.cmd > > > >> ---------------- > > > >> @echo off > > > >> grep "X-Priority: 1 (Highest)" test1.txt > > > >> echo %ERRORLEVEL% > > > >> if "%ERRORLEVEL%"=="1" echo err1 > > > >> if "%ERRORLEVEL%"=="0" echo err0 > > > >> > > > >> grep "X-Priority: 1 (Highest)" test2.txt > > > >> echo %ERRORLEVEL% > > > >> if "%ERRORLEVEL%"=="1" echo err1 > > > >> if "%ERRORLEVEL%"=="0" echo err0 > > > >> ---------------- > > > >> > > > >> Produced: > > > >> ---------------- > > > >> X-Priority: 1 (Highest) > > > >> 0 > > > >> err0 > > > >> 1 > > > >> err1 > > > >> ---------------- > > > >> > > > >> Ok, so now you've got the basics, you need to get smarter about > > testing > > > >> for > > > >> various combinations. > > > >> There is perhaps no guarantee that "X-Priority: 1" will look > > *exactly* > > > >> like > > > >> that from every MUA. > > > >> Also one MUA might use "X-Priority: 1", this another uses > > > >> "X-MSMail-Priority: High" and another uses "Importance: High". > > > >> > > > >> You will need to test for all three, and variations within to be > 100% > > > >> successful. > > > >> I've used grep with -i for case insensitivity, -q for quiet, and -P > > for > > > >> Perl > > > >> style Regular Expression matching. > > > >> That allows me to use "\s" to match any white space (space/tab) > and > > > "*" > > > >> to > > > >> match 0 or more occurrences. > > > >> So: > > > >> "X-MSMail-Priority:\s*High" > > > >> Matches: > > > >> "X-MSMail-Priority:High" > > > >> "X-MSMail-Priority: High" > > > >> "X-MSMail-Priority: High" > > > >> > > > >> There are numerous webpages on the web for Perl RegEx strings. > > (Google > > > is > > > >> your friend) > > > >> > > > >> Also I used 'setlocal' to keep the environment area for this cmd > > script > > > >> isolated from other currently running instances. > > > >> > > > >> For example: > > > >> File:: sample2.cmd > > > >> ---------------- > > > >> @echo off > > > >> setlocal > > > >> grep -Pqi "X-Priority:\s*1\s" test1.txt > > > >> set XPriHigh=%ERRORLEVEL% > > > >> > > > >> grep -Pqi "X-MSMail-Priority:\s*High" test1.txt > > > >> set XMSPriHigh=%ERRORLEVEL% > > > >> > > > >> grep -Pqi "Importance:\s*High" test1.txt > > > >> set ImportHigh=%ERRORLEVEL% > > > >> > > > >> if "%XPriHigh%"=="0" goto Found > > > >> if "%XMSPriHigh%"=="0" goto Found > > > >> if "%ImportHigh%"=="0" goto Found > > > >> > > > >> goto EOF > > > >> > > > >> :Found > > > >> echo This is a High Priority email > > > >> > > > >> :EOF > > > >> ---------------- > > > >> > > > >> The above sample2.cmd would match on ALL three High priority > > > statements. > > > >> If > > > >> you edit the file test1.txt to simulate all, some or none of the > > three > > > >> priority statements, then you'll see how it works. > > > >> > > > >> So you should be able to incorporate sample2.cmd into your > > > blackberry.cmd > > > >> > > > >> Rob :-) > > > >> > > > >> _________________________________________________ > > > >> Note To Self: Remember to put something witty here later... > > > >> > > > >> > > > >> -----Original Message----- > > > >> From: [EMAIL PROTECTED] [mailto: > > [EMAIL PROTECTED] > > > ] > > > >> On > > > >> Behalf Of Ivo Smits > > > >> Sent: Saturday, January 06, 2007 10:33 AM > > > >> To: xmail@xmailserver.org > > > >> Subject: [xmail] Re: Forwarding High Priority emails > > > >> > > > >> > > > >> Hmmmz... > > > >> According to M$ website: if [not] errorlevel number command [else > > > >> expression] > > > >> Using this on grep: > > > >> --> if errorlevel 1 goto fail > > > >> --> goto success > > > >> > > > >> > > > >> > > > >> - > > > >> To unsubscribe from this list: send the line "unsubscribe xmail" in > > > >> the body of a message to [EMAIL PROTECTED] > > > >> For general help: send the line "help" in the body of a message to > > > >> [EMAIL PROTECTED] > > > >> > > > > > > > > - > > > > To unsubscribe from this list: send the line "unsubscribe xmail" in > > > > the body of a message to [EMAIL PROTECTED] > > > > For general help: send the line "help" in the body of a message to > > > > [EMAIL PROTECTED] > > > > > > > > - > > > > To unsubscribe from this list: send the line "unsubscribe xmail" in > > > > the body of a message to [EMAIL PROTECTED] > > > > For general help: send the line "help" in the body of a message to > > > > [EMAIL PROTECTED] > > > > > > > > > > - > > > To unsubscribe from this list: send the line "unsubscribe xmail" in > > > the body of a message to [EMAIL PROTECTED] > > > For general help: send the line "help" in the body of a message to > > > [EMAIL PROTECTED] > > > > > > > > > > > > - > > To unsubscribe from this list: send the line "unsubscribe xmail" in > > the body of a message to [EMAIL PROTECTED] > > For general help: send the line "help" in the body of a message to > > [EMAIL PROTECTED] > > > > > > - > > To unsubscribe from this list: send the line "unsubscribe xmail" in > > the body of a message to [EMAIL PROTECTED] > > For general help: send the line "help" in the body of a message to > > [EMAIL PROTECTED] > > > > > > > - > To unsubscribe from this list: send the line "unsubscribe xmail" in > the body of a message to [EMAIL PROTECTED] > For general help: send the line "help" in the body of a message to > [EMAIL PROTECTED] > > > - > To unsubscribe from this list: send the line "unsubscribe xmail" in > the body of a message to [EMAIL PROTECTED] > For general help: send the line "help" in the body of a message to > [EMAIL PROTECTED] > > - To unsubscribe from this list: send the line "unsubscribe xmail" in the body of a message to [EMAIL PROTECTED] For general help: send the line "help" in the body of a message to [EMAIL PROTECTED] - To unsubscribe from this list: send the line "unsubscribe xmail" in the body of a message to [EMAIL PROTECTED] For general help: send the line "help" in the body of a message to [EMAIL PROTECTED]