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]