Dear All
please help me with following request. I am using hMail server in a company(test.com) and have several hundred of guest e-mail accounts (
[email protected]). I need to accomplish this:
When any of the guest e-mails receives a message(either from internal or external sender) this e-mail(or its copy) is sent to another address "
[email protected]" which is the same for all of these guest e-mails. But I need the sender to be identified as the
[email protected] not as the original sender which happens when I use forwarding.
I tried to prepare a simple VBS script using the OnAcceptMessage event to accomplish this.
and it works on my testing machine without internet connectivity but not in the production environment.
To be specific, if I send an e-mail to
[email protected] in my test env it is delivered to the
[email protected] with
[email protected] being a sender.
But in the production env the e-mail stays in the guest mailbox with the original sender.
I am interested in any solution, using a rule in hMail or script, anything is welcome.
Thank you for any help!
The script:
Sub OnAcceptMessage(oClient, oMessage)
'creating application object in order to perform operations as hMail server
administrator
Dim obApp
Set obApp = CreateObject("hMailServer.Application")
Dim adminLogin
Dim adminPassword
'Enter actual values for
administrator account and password
'CHANGE HERE:
adminLogin = "Admin_login"
adminPassword = "password"
Call obApp.Authenticate(adminLogin, adminPassword)
Dim addrStart
'Take first 5 characters of recipients address
addrStart = Mid(oMessage.To, 1, 5)
'if the recipient's address start with "guest"
if addrStart = "guest" then
Dim recipient
Dim recipientAddress
'enter name of the recipient and respective e-mail address()
'CHANGE HERE:
recipient = "FINAL"
recipientAddress = "
[email protected]"
'change the sender and sender e-mail address to the guest
oMessage.FromAddress = oMessage.To
oMessage.From = oMessage.To & "<" & oMessage.To & ">"
'delete recipients and enter a new one - the actual mps and its e-mail from the variables set above
oMessage.ClearRecipients()
oMessage.AddRecipient recipient, recipientAddress
'save the e-mail
oMessage.save
end if
End Sub