Simple rule is not working

Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-23 22:27

Oh bummer... Just noticed the RegEx is wrong. It's a ECMA RegEx and we need PCRE RegEx for Rules...
BOOST lib = Perl RegEx syntax ... :roll:

This is the correct one says my hMailAdmin :wink:

Code: Select all

(?:^.*([\x{2E80}-\x{2FD5}\x{3190}-\x{319f}\x{3400}-\x{4DBF}\x{4E00}-\x{9FCC}\x{F900}-\x{FAAD}]).*$)
Last edited by SorenR on 2019-03-23 22:34, edited 1 time in total.
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-03-23 22:30

jimimaseye wrote:
2019-03-23 10:15

I believe it is because he is still focusing on wanting to delete mail recognised as Chinese Japanese etc (which spamassassin does) and not understanding that the appearance and dealing with "utf8" (which your script deals with) has nothing to do with it. It seems he thinks spamassassin handles utf-8 better and therefore determines Chinese text more efficiently or, at least, it's functionality can be replicated in a rule.
SA? It is others that keep recommending it as the solution, but I have no time for it.

Which script deals with UTF8 that works without specifically targeting only one string?

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-23 22:37

Kendo wrote:
2019-03-23 22:30
jimimaseye wrote:
2019-03-23 10:15

I believe it is because he is still focusing on wanting to delete mail recognised as Chinese Japanese etc (which spamassassin does) and not understanding that the appearance and dealing with "utf8" (which your script deals with) has nothing to do with it. It seems he thinks spamassassin handles utf-8 better and therefore determines Chinese text more efficiently or, at least, it's functionality can be replicated in a rule.
SA? It is others that keep recommending it as the solution, but I have no time for it.

Which script deals with UTF8 that works without specifically targeting only one string?
While you were asleep we found a solution using Rules and RegEx. I just posted the correct (corrected) RegEx to capture chinese and japanese characters. The Rule is described a few posts back.
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

User avatar
jimimaseye
Moderator
Moderator
Posts: 8067
Joined: 2011-09-08 17:48

Re: Simple rule is not working

Post by jimimaseye » 2019-03-23 22:38

Kendo wrote:
2019-03-23 22:30

Which script deals with UTF8 that works without specifically targeting only one string?

SorenR wrote:
2019-03-21 18:14
Combine Script and Rules.

Code: Select all

Sub OnAcceptMessage(oClient, oMessage)

   '
   ' Save state of Encode Flag
   '
   Dim ECFlag : ECFlag = oMessage.EncodeFields
   '
   ' Disable Encoding of Header Fields
   '
   oMessage.EncodeFields = False
   '
   ' Do stuff with RAW headers
   '
   If oMessage.Subject = "=?utf-8?B?5LyB5Lia566h55CG6LWE5paZ?=" Then _
      oMessage.HeaderValue("X-hMailServer-Exterminate") = "YES"
   '
   ' Save new header into message.
   '
   oMessage.Save
   '
   ' Restore Encoding of Header Fields
   '
   oMessage.EncodeFields = ECFlag

End Sub
Rule: "Exterminate"

Criteria - Custom Header "X-hMailServer-Exterminate" CONTAINS "YES"
Action - Oh well... DELETE.... Or get in line like Daleks and shout "EXTERMINATE" :mrgreen:

The string "=?utf-8?B?5LyB5Lia566h55CG6LWE5paZ?=" is Base64 encoded using UTF-8 charset.
[Entered by mobile. Excuse my spelling.]
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-23 23:04

regex.jpg
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-03-24 00:10

jimimaseye wrote:
2019-03-23 22:38

If oMessage.Subject = "=?utf-8?B?5LyB5Lia566h55CG6LWE5paZ?=" Then
How does this detect anything that is not specifically "=?utf-8?B?5LyB5Lia566h55CG6LWE5paZ?="?

Or does the regex need to be included? If so, please provide an example of the completed script.

palinka
Senior user
Senior user
Posts: 950
Joined: 2017-09-12 17:57

Re: Simple rule is not working

Post by palinka » 2019-03-24 01:16

Did you try using the simple rule with Soren's regex? Directly above your last post.

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-03-24 06:11

palinka wrote:
2019-03-24 01:16
Did you try using the simple rule with Soren's regex? Directly above your last post.
Yes. That seems to work ok. Thanks everyone!

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-03-24 10:42

One got through but there might be something different because the encoding starts with "?gb" instead of "?utf". I have seen a few like this before, for example...

Subject: =?gb2312?B?vt7I6cLcwPKz+MTvw8DJ2cWuw/6xrMjpyODAy9Go5fzDxMnr0ve3og==?= =?gb2312?B?tLrS+dPvusPP67LZy/0=?=

Which came from...

巨乳萝莉厨娘美少女摸爆乳揉浪穴妩媚呻吟发春淫语好想操她

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-24 11:34

Yes, different charset. There are three different "fixed" charsets in Chinese ... plus extensions ... plus UTF-8 ... plus extensions ...

We may have to script these charsets from the raw header. I have an idea how...
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-24 13:46

OK. Here goes ...

File: EventHandlers.vbs

Code: Select all

Sub OnDeliverMessage(oMessage)

   Const strRecipient = "nospam@example.com"            ' <-- Change to reflect actual user!
   Const strRegEx     = "(\?)(GB2312|GBK|GB18030)(\?)"  ' <-- Here you can add search params!

   Dim i, ECFlag : ECFlag = oMessage.EncodeFields
   For i = 0 To oMessage.Recipients.Count-1
      If oMessage.Recipients(i).Address = strRecipient Then
         oMessage.EncodeFields = False
         With CreateObject("VBScript.RegExp")
            .Pattern = strRegEx
            .Global = True
            .MultiLine = True
            .IgnoreCase = True
            If .Test(oMessage.From) Then
               oMessage.HeaderValue("X-hMailServer-Mime-Ban") = "YES"
            End If
            If .Test(oMessage.Subject) Then
               oMessage.HeaderValue("X-hMailServer-Mime-Ban") = "YES"
            End If
         End With
         oMessage.Save
         oMessage.EncodeFields = ECFlag
      End If
   Next

End Sub
This "(\?)(gbk2312|gbk|gb18030)(\?)" you can extend with as many new charsets as you like, for example to add Russian Cyrillic it will look like this:

Subject: =?koi8-r?Q?[8-bit text is here]?=

You would add koi8-r ==> "(\?)(gbk2312|gbk|gb18030|koi8-r)(\?)"

NOTE: If you add "utf-8" equals deleting ALL mail (HAM AND SPAM) you receive with the rule!

The new mail header "X-hMailServer-Mime-Ban" is NOT global and can ONLY be used by "User Rules", not "Global Rules".

Your existing rule with the RegEx'es must be expanded with the following criteria ...
criteria.jpg
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-03-24 15:00

SorenR wrote:
2019-03-24 13:46
The new mail header "X-hMailServer-Mime-Ban"...
That worked, thanks. Nice work!

User avatar
katip
Senior user
Senior user
Posts: 671
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Simple rule is not working

Post by katip » 2019-03-24 19:33

Soren, thanks for inspiration. nice work..
i'm not sure if this will be an ultimate solution for OP though.
see the crap below. perfectly from China incl. Return-Path and final IP hop.
yes, as a supplement - if you don't care ovehaul of it, body rules in same concept might help but what if body also don't contain any CJK?
without SA Bayes (leave custom BH_LIST_UNSUBSCRIBE rule and modified BAYES_99/999 aside), this would pass thru!
certainly combat with China spam is beyond sole CJK detection. but anyway, your solution may cut +90% of it.

Code: Select all

Return-Path: return-to@ec.chinahomelife247.cn
Delivered-To: katip@...
X-Spam-Checker-Version: SpamAssassin 3.4.2 (svnunknown) on Server
X-Spam-Flag: YES
X-Spam-Level: ***************
X-Spam-Status: Yes, score=16.0 required=5.0 tests=BAYES_99,BAYES_999, BH_LIST_UNSUBSCRIBE,DKIM_INVALID,DKIM_SIGNED,HTML_FONT_LOW_CONTRAST,
 HTML_MESSAGE,MPART_ALT_DIFF autolearn=disabled version=3.4.2
X-Spam-Test-Scores: BAYES_99=4.5,BAYES_999=0.5,BH_LIST_UNSUBSCRIBE=10, DKIM_INVALID=0.1,DKIM_SIGNED=0.1,HTML_FONT_LOW_CONTRAST=0.001,
 HTML_MESSAGE=0.001,MPART_ALT_DIFF=0.79
X-Spam-Total-Score: 16.0
X-Spam-Report: *  4.5 BAYES_99 BODY: Bayes spam probability is 99 to 100% *      [score: 1.0000]
 *  0.5 BAYES_999 BODY: Bayes spam probability is 99.9 to 100% *      [score:
 1.0000] *   10 BH_LIST_UNSUBSCRIBE Found a List-Unsubscribe header *  0.0
 HTML_MESSAGE BODY: HTML included in message *  0.8 MPART_ALT_DIFF BODY:
 HTML and text parts are different *  0.0 HTML_FONT_LOW_CONTRAST BODY: HTML
 font color similar or *      identical to background *  0.1 DKIM_SIGNED
 Message has a DKIM or DK signature, not necessarily *       valid *  0.1
 DKIM_INVALID DKIM or DK signature exists, but is not valid
X-Spam-Virus: No
Received: from smtp.ceopxkc.com (smtp.kenji1205.win [103.42.106.106]) by mail....
 with ESMTP ; Wed, 6 Mar 2019 09:11:40 +0300
Received: from 127.0.0.1 by ESMTP (Postfix) for yasin.yilmaz@...; Wed,
 06 Mar 2019 14:11:35 +0800 (CST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ec.chinahomelife247.cn; s=dmddkim;
 t=1551852655; bh=bD1A2ZXPb9nMVz+/5yAgiPVHyTVeZhyIMX5hbyCvcRw=; h=Date:Message-Id:To:From:Subject:Content-Type;
 b=QnPnhms3kB53aRGa+Cn2ujtk0ycfTeQQIyvglViJu7v31lsS8kw/PVKQsdoUB0DxZ
 mM+NA1dKYI3mkyLU0xEFwI0XzhULQ3pAc5WbZYu4ldWZBrmJcoZ3zRm8LcF29gTonE
 lYi+b35RXqnlHSbMiXFlVi6Py8BkxwDQtYXx8MBw=
Date: Wed, 06 Mar 2019 14:10:55 +0800
MIME-Version: 1.0
Message-Id: <S7Y1tPyfa2tsav6.CEgaWxr_z7E1NjEFAAA32@ec.chinahomelife247.cn>
To: yasin.yilmaz@....com
From: Chinahomelife247 <qijialing@ec.chinahomelife247.cn>
Reply-To: "Chinahomelife247" <qijialing@meorient.com>
Subject: [SA][16.0][1.0000] YASIN YILMAZ get the best quotation from China, the free   tool could help you.
X-Mailer: DMD-MTA
X-Hash: DcRBCgAhCADAHwVlER18TLiGQhrE.t.dOQxhHmEIrcf9h5FjI9QWgkyJRH3KMd66uNSeyEMfND5X2d8PA88
Feedback-ID: ec.chinahomelife247.cn:19:357:webpower
List-Unsubscribe: <http://ec.chinahomelife247.cn/x/unsubscribe/?MIDRID=S7Y1tPyfa2tsav6.CEgaWxr_z7E1NjH9X5BfXGJrCAAA74>,
 <mailto:unsubscribe@ec.chinahomelife247.cn?subject=DcRBCgAhCADAHwVlER18TLiGQhrE.t.dOQxhHmEIrcf9h5FjI9QWgkyJRH3KMd66uNSeyEMfND5X2d8PA88>
List-Unsubscribe-Post: List-Unsubscribe=One-Click
List-Help: <http://ec.chinahomelife247.cn/x/plugin/?pName=list_help&MIDRID=S7Y1tPyfa2tsav6.CEgaWxr_z7E1NjEFAAA32&Z=1542863102>
Content-Type: multipart/alternative; boundary="D155185265388836963"
X-Spam-Prev-Subject: YASIN YILMAZ get the best quotation from China, the free tool could help
 you.
X-HMS-Envelope-From: return-to@ec.chinahomelife247.cn
X-HMSwl-From: No
X-Envelope-From: return-to@ec.chinahomelife247.cn
X-Envelope-To: yasin.yilmaz@....com
X-hMailServer-LoopCount: 1

YASIN YILMAZ get the best quotation from China, the free tool could help you.

Hello yasin.yilmaz@....com,

看上去似乎您的e-mail软件不支持HTML。
请访问下面的网页使您能够在网页浏览其中阅读这条信息:
http://ec.chinahomelife247.cn/x/?S7Y1tPyfa2tsav6.CEgaWxr_z7E1NjEFAAA32
Katip
--
HMS 5.7.0-B2428-LTS-64-bit, MySQL 5.7.24, SA 3.4.2, ClamAV 0.101.2 + SaneS

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-24 20:28

Yeah... The only 100% SPAM FREE solution is to shutdown your mailserver :wink:

" * 10 BH_LIST_UNSUBSCRIBE Found a List-Unsubscribe header " :shock:

" Received: from smtp.ceopxkc.com (smtp.kenji1205.win [103.42.106.106]) "
1: HELO greeting and hostname do not match. RFC violation. (but I don't check for it on my server)
2: I generally discard anything ending in ".win"

You could extend the rule to include BODY but ONLY if recipient should NEVER receive anything Chinese.

But, yeah. A well trained Bayes DB is worth every penny. I only reject "Static/Reproduceable SPAM", everything else is received and sidetracked for SpamAssassin to learn.

The day all my Blacklists are all out-of-business is the day my SpamAssassin graduate :mrgreen:
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

User avatar
katip
Senior user
Senior user
Posts: 671
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Simple rule is not working

Post by katip » 2019-03-24 20:58

SorenR wrote:
2019-03-24 20:28
" * 10 BH_LIST_UNSUBSCRIBE Found a List-Unsubscribe header " :shock:
haha, i know, but is ok with our content.
SorenR wrote:
2019-03-24 20:28
You could extend the rule to include BODY but ONLY if recipient should NEVER receive anything Chinese.
(as a globally connected shipping agency) we DO receive legit mails where correspondance (Subject/Body) is in EN but people tend to write their names in "From" in CJK - which we totally respect of course. but not only this. after initial message, Subject sometimes adds initials "Re:" or "Fwd:" in CJK too...
SorenR wrote:
2019-03-24 20:28
But, yeah. A well trained Bayes DB is worth every penny.
definitely +1
SorenR wrote:
2019-03-24 20:28
The day all my Blacklists are all out-of-business is the day my SpamAssassin graduate :mrgreen:
for me, not in this world i think :lol:
Katip
--
HMS 5.7.0-B2428-LTS-64-bit, MySQL 5.7.24, SA 3.4.2, ClamAV 0.101.2 + SaneS

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-03-25 23:29

This one got through...

Subject: =?gb2312?B?svrGt76twO3I57rOtqjOu6O/yOe6zrLfu67T0L661fnBprXEsu7S7A==?= =?gb2312?B?u6+y+sa3y9XW3bXIs8fK0Mno09Cw7MrCtKYyMDE5LzMv?=
=?gb2312?B?MjYg0MfG2rb+yc/O5yA1OjE5OjE0?=

Re: 产品经理如何定位?如何策划有竞争力的差异化产品苏州等城市设有办事处2019/3/26 星期二上午 5:19:14

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-26 12:15

If you look at the raw email, does it have the "X-hMailServer-Mime-Ban: YES" header ?
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-03-26 12:44

SorenR wrote:
2019-03-26 12:15
If you look at the raw email, does it have the "X-hMailServer-Mime-Ban: YES" header ?
No. It was not detected/tagged.

Now have 3 emails that include... "Subject: =?gb2312?B?..."

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-26 18:52

Just to confirm...

You added the script to your EventHandlers.vbs and enabled scripting?

You added the extra criteria to your account rule?
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-03-26 22:06

Yes and tested. Didn't have any since except for these 3 emails just recently.

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-26 23:38

Kendo wrote:
2019-03-26 22:06
Yes and tested. Didn't have any since except for these 3 emails just recently.
Hmm... Script is designed to catch NON-utf8 mime charset like "?gb2312?".

I'll send you my SPAMTrap account in a PM, can you forward the 3 mails or any like it the next 1 or 2 days?
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-27 01:56

Got 3 mails, thanks... Detected them fine - no prob.

Went back to my thinking room... BRB..
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-27 02:06

In your script change this line as I have added additional charactersets

Code: Select all

   Const strRegEx      = "(gb(k|2312|18030)|big5|euc-(cn|tw)|iso-2022-(cn|jp))"   ' <-- Here you can add search params!
Also... Do not forget to change "nospam@example.com" to match your local nospam user!

Code: Select all

   Const strRecipient = "nospam@example.com"   ' <-- Change to reflect actual user!
I may have found a bug in what I believe is the BOOST library implementation of RegEx in my version 5.4.2 of hMailServer so I have a version of the script that will check BOTH the RegEx and the Charsets if you prefer that.
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-03-27 22:22

SorenR wrote:
2019-03-27 02:06

Code: Select all

   Const strRegEx      = "(gb(k|2312|18030)|big5|euc-(cn|tw)|iso-2022-(cn|jp))"   ' <-- Here you can add search params!
Without the "?"

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-28 01:05

Kendo wrote:
2019-03-27 22:22
SorenR wrote:
2019-03-27 02:06

Code: Select all

   Const strRegEx      = "(gb(k|2312|18030)|big5|euc-(cn|tw)|iso-2022-(cn|jp))"   ' <-- Here you can add search params!
Without the "?"
Can add the "?", no problem..

"(\?)(gb(k|2312|18030)|big5|euc-(cn|tw)|iso-2022-(cn|jp))(\?)"

Character sets: gbk, gb3212, gb18030, big5, euc-cn, euc-tw, iso-2022-cn and iso-2022-jp

You are aware that you need to "reload" the script whenever you make changes. Either you restart hMailServer (net stop/net start) or use hMailAdmin -> Settings -> Advanced -> Script [Reload scripts] [check syntax] and it should respond with "The syntax is correct".
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-03-28 01:18

SorenR wrote:
2019-03-28 01:05
You are aware that you need to "reload" the script whenever you make changes.
Yep. No problem.

User avatar
jimimaseye
Moderator
Moderator
Posts: 8067
Joined: 2011-09-08 17:48

Re: Simple rule is not working

Post by jimimaseye » 2019-03-28 09:55

SorenR wrote:
2019-03-28 01:05
....... or use hMailAdmin -> Settings -> Advanced -> Script [Reload scripts] [check syntax] and it should respond with "The syntax is correct".
You dont need and shouldn't [Reload Scripts] to check syntax. You should [check syntax] first (this checks the current script saved to disk) and then, if correct and OK, hit [RELOAD SCRIPT] to make it live. (Otherwise you risk temporarily loading a failing script in to memory as live that will error every time there is a connection or message whilst you go about trying to figure out what to correct. It's best to correct it without loading it.)
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

User avatar
mattg
Moderator
Moderator
Posts: 19982
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Simple rule is not working

Post by mattg » 2019-03-28 11:06

I have always thought that what SorenR says about this is accurate.

I have always 'loaded' then checked, re-loading old file if it fails until fixed.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

User avatar
SorenR
Senior user
Senior user
Posts: 3169
Joined: 2006-08-21 15:38
Location: Denmark

Re: Simple rule is not working

Post by SorenR » 2019-03-28 12:50

jimimaseye wrote:
2019-03-28 09:55
SorenR wrote:
2019-03-28 01:05
....... or use hMailAdmin -> Settings -> Advanced -> Script [Reload scripts] [check syntax] and it should respond with "The syntax is correct".
You dont need and shouldn't [Reload Scripts] to check syntax. You should [check syntax] first (this checks the current script saved to disk) and then, if correct and OK, hit [RELOAD SCRIPT] to make it live. (Otherwise you risk temporarily loading a failing script in to memory as live that will error every time there is a connection or message whilst you go about trying to figure out what to correct. It's best to correct it without loading it.)
I think I always knew that, I have no idea when the other procedure became part of my unconscious mind.
But yes, clearly you should CHECK syntax BEFORE LOADing the script.

Damn, now I have to re-program my brain stem. This is almost as bad as trying to "right click" a 1 button Mac mouse.
SørenR.

The quantum rule of insecurity which states that the act of observing how vulnerable a host or service is changes the insecurity level of the service.

User avatar
mattg
Moderator
Moderator
Posts: 19982
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Simple rule is not working

Post by mattg » 2019-03-29 03:56

I just learned something

I had to test it myself to be sure - but that is correct.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-09-12 01:15

In line 2 below, can I add multiple email addresses separated by comma?...

Sub OnDeliverMessage(oMessage)

Const strRecipient = "nospam@exanple.com" ' <-- Change to reflect actual user!
Const strRegEx = "(\?)(gb(k|2312|18030)|big5|euc-(cn|tw)|Shi...

User avatar
mattg
Moderator
Moderator
Posts: 19982
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Simple rule is not working

Post by mattg » 2019-09-12 03:29

Not with the existing code, you would need to modify slightly to achieve that
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-09-12 07:26

mattg wrote:
2019-09-12 03:29
Not with the existing code, you would need to modify slightly to achieve that
What do you recommend?

User avatar
mattg
Moderator
Moderator
Posts: 19982
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Simple rule is not working

Post by mattg » 2019-09-12 11:04

Find someone close to you who knows VB and PAY THEM to do the changes that you need

IT people are always looking for more work
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Kendo
Normal user
Normal user
Posts: 81
Joined: 2015-07-08 23:33
Location: Rural Australia

Re: Simple rule is not working

Post by Kendo » 2019-09-12 22:01

mattg wrote:
2019-09-12 11:04
IT people are always looking for more work
Something like this should do...

If oMessage.Recipients(i).Address = strRecipient1 or oMessage.Recipients(i).Address = strRecipient2 Then

User avatar
mattg
Moderator
Moderator
Posts: 19982
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Simple rule is not working

Post by mattg » 2019-09-13 01:03

If there is only two, then yes that should work
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Post Reply