Community Discussions and Support
Problem with a general rule set

[quote user="dilberts_left_nut"]

Maybe I'm missing what you are trying to achieve.

How often would the rule need to be modified?

I would either modify the source template and regenerate the rules, or use something like the following to replace the rule in each .rul file.

for %a in (*.rul) do copy /y %a temp && cat temp | sed "s/oldstring/newstring/" > %a

This uses 'cat' (probably inappropriately, but I'm fuzzy on the sed syntax ;)) & 'sed' from Gnu tools for windows, but there may be a (nastier?) way to do it with native tools.

[/quote]

It's for a high school, I'll have many rules whose 'root' won't be modified ('root' is for me the top of the rule where is the filtering process), the only thing that will be modified is the forward addresses, but it will be completely renewed once a year. That's why I would have prefer to have all this filtering process (same for all rules: check if the sender is allowed) in a separate rule that could be ran from within the main rule, if I want to modify the filtering process I'd just have to modify one rule.

BTW I won't do it via  batch but vbscript.

Regards

[quote user="dilberts_left_nut"]<p>Maybe I'm missing what you are trying to achieve.</p> <p>How often would the rule need to be modified?</p> <p>I would either modify the source template and regenerate the rules, or use something like the following to replace the rule in each .rul file.</p> for %a in (*.rul) do copy /y %a temp && cat temp | sed "s/oldstring/newstring/" > %a <p>This uses 'cat' (probably inappropriately, but I'm fuzzy on the sed syntax ;)) & 'sed' from Gnu tools for windows, but there may be a (nastier?) way to do it with native tools. </p><p>[/quote]</p><p>It's for a high school, I'll have many rules whose 'root' won't be modified ('root' is for me the top of the rule where is the filtering process), the only thing that will be modified is the forward addresses, but it will be completely renewed once a year. That's why I would have prefer to have all this filtering process (same for all rules: check if the sender is allowed) in a separate rule that could be ran from within the main rule, if I want to modify the filtering process I'd just have to modify one rule.</p><p>BTW I won't do it via  batch but vbscript. </p><p>Regards </p>

Hi there

 

Following this thread : http://community.pmail.com/forums/thread/27517.aspx

Before forwarding the incoming mail to the recipients I want to test if the sender is member of a list (only the member of the list can send mails to this address).

So the first line in the set is a test "Scan list", if the sender doesn't belong to the list I want to send him/her a message to inform him/her that he/she can't send mails to this address, this works (almost fine, some details could be improved)...

I use flow control to test if the sender belongs to the list or not (and actions that go with). My problem is that I have a lot of users and a lot of groups, each group will have its filtering rule and each will be created via scripts (to add new users).

It is very simple in a script to add a line at the end of a text file, it can be done in the middle of the file but it is not that simple, that's why I'd like to have all the Always Forward ... at the bottom of the set.

My aim would be to have a filtering rule having this structure:

If the sender belongs to a list goto SEND label

rem: the sender does not belong to the list

Send him/her a reply

Stop the rule action

:SEND label

rem: the sender belongs to the list

Always forward user1@mydomain.com

Always forward user2@mydomain.com

Always forward user3@mydomain.com

 My problem is with the action "Stop the rule action" (kind of wscript.quit in vbs)

Thanks

 

<p>Hi there</p><p> </p><p>Following this thread : <a href="/forums/thread/27517.aspx" target="_blank" mce_href="/forums/thread/27517.aspx">http://community.pmail.com/forums/thread/27517.aspx</a></p><p>Before forwarding the incoming mail to the recipients I want to test if the sender is member of a list (only the member of the list can send mails to this address).</p><p>So the first line in the set is a test "Scan list", if the sender doesn't belong to the list I want to send him/her a message to inform him/her that he/she can't send mails to this address, this works (almost fine, some details could be improved)...</p><p>I use flow control to test if the sender belongs to the list or not (and actions that go with). My problem is that I have a lot of users and a lot of groups, each group will have its filtering rule and each will be created via scripts (to add new users).</p><p> It is very simple in a script to add a line at the end of a text file, it can be done in the middle of the file but it is not that simple, that's why I'd like to have all the Always Forward ... at the bottom of the set.</p><p>My aim would be to have a filtering rule having this structure:</p><blockquote><p>If the sender belongs to a list goto SEND label</p><p>rem: the sender does not belong to the list</p><p>Send him/her a reply</p><p>Stop the rule action</p><p>:SEND label</p><p>rem: the sender belongs to the list </p><p>Always forward user1@mydomain.com</p><p>Always forward user2@mydomain.com</p><p>Always forward user3@mydomain.com </p></blockquote><p> My problem is with the action "Stop the rule action" (kind of wscript.quit in vbs) </p><p>Thanks </p><p> </p>

There is an action called "Exit from rule processing", I think that's what you are looking for. "Always exit processing" before the label should do the trick.

/Rolf 

<p>There is an action called "Exit from rule processing", I think that's what you are looking for. "Always exit processing" before the label should do the trick.</p><p>/Rolf </p>

Thanks a lot Rolf, I had a look at the actions many times but never saw it (probably a problem with my eyes...). It works!

Thanks again

<p>Thanks a lot Rolf, I had a look at the actions many times but never saw it (probably a problem with my eyes...). It works!</p><p>Thanks again </p>

It works just like I want it to work!  (I just have to write the scripts that will create/modify the rules and add the correct aliases).

But now I'd like to make it simpler to maintain. All my rules (more than 100) will begin with the same actions (filtering on sender's address), the only difference will be the users I forward the message to (and the alias). If I want to modify these common actions I'll have to modify more than 100 rules, I was wondering if it is possible to call a rule from within a rule, this way I could have one test rule which is called at the beginning of all the forward rules (it would be easier to modify just one rule than more than 100).

Another question: It's possible to test the message attributes, there is a value "Originates from a non-local source", what does this mean? the address domain is the local domain or the message has been sent using the local smtp (it does not come from outside)?

Last comment: Each time I open a rule set, an empty comment line is added at the top. Is it a bug?

Thanks a lot Rolf and  Dilberts, you saved me many hours (even days).

<p>It works just like I want it to work!  (I just have to write the scripts that will create/modify the rules and add the correct aliases). </p><p>But now I'd like to make it simpler to maintain. All my rules (more than 100) will begin with the same actions (filtering on sender's address), the only difference will be the users I forward the message to (and the alias). If I want to modify these common actions I'll have to modify more than 100 rules, I was wondering if it is possible to call a rule from within a rule, this way I could have one test rule which is called at the beginning of all the forward rules (it would be easier to modify just one rule than more than 100).</p><p>Another question: It's possible to test the message attributes, there is a value "Originates from a non-local source", what does this mean? the address domain is the local domain or the message has been sent using the local smtp (it does not come from outside)?</p><p>Last comment: Each time I open a rule set, an empty comment line is added at the top. Is it a bug? </p><p>Thanks a lot Rolf and  Dilberts, you saved me many hours (even days). </p>

If you are generating your 100+ .rul's with a script then does that not make it easy to alter one copy of the first test and apply it to all?

 

I think the 'local' in this context means submitted directly to the local queue (as a .101 file), so ANY smtp delivery triggers this test.

 

Never noticed the extra comment line.

<p>If you are generating your 100+ .rul's with a script then does that not make it easy to alter one copy of the first test and apply it to all?</p><p> </p><p>I think the 'local' in this context means submitted directly to the local queue (as a .101 file), so ANY smtp delivery triggers this test.</p><p> </p><p>Never noticed the extra comment line. </p>

> Last comment: Each time I open a rule set, an empty comment line is added at the top. Is it a bug?

What version of Mercury are you using?  I've not seen that particular problem in Mercury for years.

 

<p>> Last comment: Each time I open a rule set, an empty comment line is added at the top. Is it a bug? What version of Mercury are you using?  I've not seen that particular problem in Mercury for years.</p><p> </p>

[quote user="Thomas R. Stephenson"]

> Last comment: Each time I open a rule set, an empty comment line is added at the top. Is it a bug?

What version of Mercury are you using?  I've not seen that particular problem in Mercury for years.

 

[/quote]

v4.72 but I found the reason for the problem: as I said earlier I want to create rules via script, i did some tries and just after the first line of the rule (Mercury rule set) I had an empty line, that's why when I opened it in Mercury it replaced it by a comment, I removed the empty line and there is no longer a comment added.

Thanks

Regards

[quote user="Thomas R. Stephenson"]<p>> Last comment: Each time I open a rule set, an empty comment line is added at the top. Is it a bug? What version of Mercury are you using?  I've not seen that particular problem in Mercury for years.</p><p> </p><p>[/quote]</p><p>v4.72 but I found the reason for the problem: as I said earlier I want to create rules via script, i did some tries and just after the first line of the rule (Mercury rule set) I had an empty line, that's why when I opened it in Mercury it replaced it by a comment, I removed the empty line and there is no longer a comment added.</p><p>Thanks</p><p>Regards </p>

[quote user="dilberts_left_nut"]

If you are generating your 100+ .rul's with a script then does that not make it easy to alter one copy of the first test and apply it to all?[/quote]

If there is no other solution that's what I'm going to do, but I would have been easier to modify manually one rule than to create/modify a script to modify many.

Maybe it could be a new feature for a future version: a rule can run another rule.

Regards

[quote user="dilberts_left_nut"]<p>If you are generating your 100+ .rul's with a script then does that not make it easy to alter one copy of the first test and apply it to all?[/quote]</p><p>If there is no other solution that's what I'm going to do, but I would have been easier to modify manually one rule than to create/modify a script to modify many.</p><p>Maybe it could be a new feature for a future version: a rule can run another rule.</p><p>Regards </p>

Maybe I'm missing what you are trying to achieve.

How often would the rule need to be modified?

I would either modify the source template and regenerate the rules, or use something like the following to replace the rule in each .rul file.

for %a in (*.rul) do copy /y %a temp && cat temp | sed "s/oldstring/newstring/" > %a

This uses 'cat' (probably inappropriately, but I'm fuzzy on the sed syntax ;)) & 'sed' from Gnu tools for windows, but there may be a (nastier?) way to do it with native tools.

<p>Maybe I'm missing what you are trying to achieve.</p> <p>How often would the rule need to be modified?</p> <p>I would either modify the source template and regenerate the rules, or use something like the following to replace the rule in each .rul file.</p> for %a in (*.rul) do copy /y %a temp && cat temp | sed "s/oldstring/newstring/" > %a <p>This uses 'cat' (probably inappropriately, but I'm fuzzy on the sed syntax ;)) & 'sed' from Gnu tools for windows, but there may be a (nastier?) way to do it with native tools. </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