Community Discussions and Support
Policy Commandline Substitutions

Well, that was rather embarrassing for a whole mornings work.  Thanks.[:'(]

Well, that was rather embarrassing for a whole mornings work.  Thanks.[:'(]

Goal: Parse incoming mail, insert relevant data into a database, delete message afterward.  Non-related mail messages are passed through to mailing lists and move out to an exchange server.

 

Problem: I've set up a really simple script to see all that filtering rules are going to work and they don't (not quite).

 

Policy:

Name: Test

Type: Run and examine return code

Command line: C:\....\test.bat ~X

Action: Return Message if undeliverable

 

Test.bat:

@echo off

echo %1

pause

exit 0

 

Every time mail is sent Mercury kills it with the policy.  However...

Command line: C:\.....\test.bat

test.bat: - Works as expected (mail passed through)

@echo off

pause

exit 0

test.bat: -Works as expected (mail killed)

@echo off

pause

exit 1

 

I've read a few examples, but haven't been able to figure out what I'm doing wrong, and I assume it is related to how I am using or passing the substitutions.  Thoughts?  

<p>Goal: Parse incoming mail, insert relevant data into a database, delete message afterward.  Non-related mail messages are passed through to mailing lists and move out to an exchange server.</p> <p> </p> <p>Problem: I've set up a really simple script to see all that filtering rules are going to work and they don't (not quite).</p> <p> </p> <p>Policy: </p> <p>Name: Test</p><p>Type: Run and examine return code</p><p>Command line: C:\....\test.bat ~X</p><p>Action: Return Message if undeliverable </p><p> </p><p>Test.bat:</p><p>@echo off</p><p>echo %1</p><p>pause</p><p>exit 0 </p><p> </p><p>Every time mail is sent Mercury kills it with the policy.  However...</p><p>Command line: C:\.....\test.bat</p><p>test.bat: - Works as expected (mail passed through) </p><p>@echo off</p><p>pause</p><p>exit 0 </p><p>test.bat: -Works as expected (mail killed)</p><p>@echo off</p><p>pause</p><p>exit 1 </p><p> </p><p>I've read a few examples, but haven't been able to figure out what I'm doing wrong, and I assume it is related to how I am using or passing the substitutions.  Thoughts?   </p>

The ~X parameter is the path to the file containing the message to check. I'm not sure what problem you have with it, but you should probably write the commandline like this:

C:\pathtodirectory\test.bat "~X"

Quotation marks are needed if there are spaces somewhere in the path.

/Rolf 

<p>The <span class="Apple-style-span" style="font-family: Tahoma, Arial, Helvetica; ">~X parameter is the path to the file containing the message to check. I'm not sure what problem you have with it, but you should probably write the commandline like this:</span></p><p><span class="Apple-style-span" style="font-family: Tahoma, Arial, Helvetica; ">C:\pathtodirectory\test.bat "~X"</span></p><p>Quotation marks are needed if there are spaces somewhere in the path.</p><p>/Rolf </p>
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft