forward code
forward code
Hi
I want that when an account received a mail then forward the mail to another account which is specified in VBscript ,
but I don't know VBSript ,so I put on My code
I think there a lot of misktake, Please help me to correct it
thanks!
sub onAcceptMessage(oClient,oMessage)
If oMessage.Recipient.Address="huns@h127.0.0.1" then
AddBCCRecipient oMessage,"ayu","ayu@127.0.0.1"
oMessage.save
End If
End Sub
Sub AddBCCRecipient(oMessage, sName, sAddress)
Dim Header
sToHeader = oMessage.HeaderValue("To")
oMessage.AddRecipient sName, sAddress
oMessage.HeaderValue("To") = Header
End Sub
I want that when an account received a mail then forward the mail to another account which is specified in VBscript ,
but I don't know VBSript ,so I put on My code
I think there a lot of misktake, Please help me to correct it
thanks!
sub onAcceptMessage(oClient,oMessage)
If oMessage.Recipient.Address="huns@h127.0.0.1" then
AddBCCRecipient oMessage,"ayu","ayu@127.0.0.1"
oMessage.save
End If
End Sub
Sub AddBCCRecipient(oMessage, sName, sAddress)
Dim Header
sToHeader = oMessage.HeaderValue("To")
oMessage.AddRecipient sName, sAddress
oMessage.HeaderValue("To") = Header
End Sub
You dont need script for this, you can just create a rule for that account:
-create a rule (check that is active) on the huns@h127.0.0.1 account
-for criteria select "use AND" and add a new criteria that the "Recipient list" "not contains" ayu@127.0.0.1
-add an action "Forward email" and enter "ayu@127.0.0.1" as the address to forward to.
-create a rule (check that is active) on the huns@h127.0.0.1 account
-for criteria select "use AND" and add a new criteria that the "Recipient list" "not contains" ayu@127.0.0.1
-add an action "Forward email" and enter "ayu@127.0.0.1" as the address to forward to.
Only messages that _are_ to the account huns@127.0.0.1 will be effected by the rules you enter for this account. Hence the recipient list will always contain huns@127.0.0.1.
This should be made as a global rule. I rewrote yours to this:
Chose global rules
in rule tab
1) use "and"
2) Add criteria. Under pre-defined field, select Recipient List, In search type,select Not Contains, value huns@127.0.0.1
3) Add a new criteria, pre-defined field recipient list, search type "Not Contain" value ayu@127.0.0.1
4) Under action select Forward to ayu@127.0.0.1
5) save the rule
This should be made as a global rule. I rewrote yours to this:
Chose global rules
in rule tab
1) use "and"
2) Add criteria. Under pre-defined field, select Recipient List, In search type,select Not Contains, value huns@127.0.0.1
3) Add a new criteria, pre-defined field recipient list, search type "Not Contain" value ayu@127.0.0.1
4) Under action select Forward to ayu@127.0.0.1
5) save the rule
Martin, just curious why a global rule instead of a rule just on that account? What I gave him should accomplish what he wanted, to forward mail from one account to the other - that is what I am using for hundreds of forwarding rules for my clients. Wouldn't a global rule be applied to all accounts?
His rule did not work because he did not do what I told him. he put huns@127.0.0.1 in the not contains criteria of the rule instead of ayu@127.0.0.1 as I instructed.
His rule did not work because he did not do what I told him. he put huns@127.0.0.1 in the not contains criteria of the rule instead of ayu@127.0.0.1 as I instructed.
Re: forward code
How if the Criteria not any in Rule
for example I want to filter 3 last character 68909@domain.MX ,
from last ".MX" I will forward to other email
in criteria no rule for last character from
& I can not use criteria contain because I don't forward if .MX in front or mid
Thx u
for example I want to filter 3 last character 68909@domain.MX ,
from last ".MX" I will forward to other email
in criteria no rule for last character from
& I can not use criteria contain because I don't forward if .MX in front or mid
Thx u

Re: forward code
try criteria Regular Expression
.+?\.mx
and pls open a new thread if you'd have further question.
.+?\.mx
and pls open a new thread if you'd have further question.
Katip
--
HMS 5.7.0 x64, MariaDB 10.4.10 x64, SA 3.4.2, ClamAV 0.101.2 + SaneS
--
HMS 5.7.0 x64, MariaDB 10.4.10 x64, SA 3.4.2, ClamAV 0.101.2 + SaneS
Re: forward code
OK Mr. Katip
I will open new thread
I will open new thread