Updated to recognise version 5 and 6 of MailEnable.
Will work under 64bit .Net. Fixed issue where saving reply to address could cause .Net error. Faster to list mailboxes.
This commit is contained in:
parent
c28faf43ce
commit
7fb6b53e20
1 changed files with 251 additions and 265 deletions
|
@ -41,23 +41,12 @@ Public Class MailEnable
|
||||||
Inherits HostingServiceProviderBase
|
Inherits HostingServiceProviderBase
|
||||||
Implements IMailServer
|
Implements IMailServer
|
||||||
|
|
||||||
Private Const DOMAIN_PROG_ID As String = "MEAOSM.Domain"
|
|
||||||
Private Const BLACKLIST_PROG_ID As String = "MEAOSM.Blacklist"
|
|
||||||
Private Const POSTOFFICE_PROG_ID As String = "MEAOPO.Postoffice"
|
|
||||||
Private Const LOGIN_PROG_ID As String = "MEAOAU.Login"
|
|
||||||
Private Const MAILBOX_PROG_ID As String = "MEAOPO.Mailbox"
|
|
||||||
Private Const MAILLIST_PROG_ID As String = "MEAOLS.List"
|
|
||||||
Private Const LIST_MEMBER_PROG_ID As String = "MEAOLS.ListMember"
|
|
||||||
Private Const ADDRESS_MAP_PROG_ID As String = "MEAOAM.AddressMap"
|
|
||||||
Private Const GROUP_PROG_ID As String = "MEAOPO.Group"
|
|
||||||
Private Const GROUP_MEMBER_PROG_ID As String = "MEAOPO.GroupMember"
|
|
||||||
|
|
||||||
#Region "Domains"
|
#Region "Domains"
|
||||||
|
|
||||||
Public Overridable Function GetDomains() As String() Implements IMailServer.GetDomains
|
Public Overridable Function GetDomains() As String() Implements IMailServer.GetDomains
|
||||||
|
|
||||||
Dim domainList As List(Of String) = New List(Of String)
|
Dim domainList As List(Of String) = New List(Of String)
|
||||||
Dim po As Object = CreateObject(POSTOFFICE_PROG_ID)
|
Dim po As New WebsitePanel.Providers.Mail.MailEnablePostoffice
|
||||||
|
|
||||||
po.Account = ""
|
po.Account = ""
|
||||||
po.Name = ""
|
po.Name = ""
|
||||||
|
@ -76,7 +65,7 @@ Public Class MailEnable
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Overridable Function DomainExists(ByVal domainName As String) As Boolean Implements IMailServer.DomainExists
|
Public Overridable Function DomainExists(ByVal domainName As String) As Boolean Implements IMailServer.DomainExists
|
||||||
Dim domain As Object = CreateObject(DOMAIN_PROG_ID)
|
Dim domain As New WebsitePanel.Providers.Mail.MailEnableDomain
|
||||||
|
|
||||||
ResetDomain(domain)
|
ResetDomain(domain)
|
||||||
domain.AccountName = domainName
|
domain.AccountName = domainName
|
||||||
|
@ -87,7 +76,7 @@ Public Class MailEnable
|
||||||
|
|
||||||
Public Overridable Function GetDomain(ByVal domainName As String) As MailDomain Implements IMailServer.GetDomain
|
Public Overridable Function GetDomain(ByVal domainName As String) As MailDomain Implements IMailServer.GetDomain
|
||||||
Dim info As MailDomain = Nothing
|
Dim info As MailDomain = Nothing
|
||||||
Dim domain As Object = CreateObject(DOMAIN_PROG_ID)
|
Dim domain As New WebsitePanel.Providers.Mail.MailEnableDomain
|
||||||
|
|
||||||
ResetDomain(domain)
|
ResetDomain(domain)
|
||||||
domain.AccountName = domainName
|
domain.AccountName = domainName
|
||||||
|
@ -104,7 +93,7 @@ Public Class MailEnable
|
||||||
|
|
||||||
Public Overridable Sub CreateDomain(ByVal domainInfo As MailDomain) Implements IMailServer.CreateDomain
|
Public Overridable Sub CreateDomain(ByVal domainInfo As MailDomain) Implements IMailServer.CreateDomain
|
||||||
'create a new postoffice for each account
|
'create a new postoffice for each account
|
||||||
Dim postoffice As Object = CreateObject(POSTOFFICE_PROG_ID)
|
Dim postoffice As New WebsitePanel.Providers.Mail.MailEnablePostoffice
|
||||||
postoffice.Account = domainInfo.Name
|
postoffice.Account = domainInfo.Name
|
||||||
postoffice.Name = domainInfo.Name
|
postoffice.Name = domainInfo.Name
|
||||||
postoffice.Status = IIf((domainInfo.Enabled), 1, 0)
|
postoffice.Status = IIf((domainInfo.Enabled), 1, 0)
|
||||||
|
@ -113,7 +102,7 @@ Public Class MailEnable
|
||||||
Throw New Exception("Postoffice creation failedNot ")
|
Throw New Exception("Postoffice creation failedNot ")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim domain As Object = CreateObject(DOMAIN_PROG_ID)
|
Dim domain As New WebsitePanel.Providers.Mail.MailEnableDomain
|
||||||
domain.AccountName = domainInfo.Name
|
domain.AccountName = domainInfo.Name
|
||||||
domain.DomainName = domainInfo.Name
|
domain.DomainName = domainInfo.Name
|
||||||
domain.DomainRedirectionHosts = domainInfo.RedirectionHosts
|
domain.DomainRedirectionHosts = domainInfo.RedirectionHosts
|
||||||
|
@ -127,7 +116,7 @@ Public Class MailEnable
|
||||||
Dim blackListedDomain As String
|
Dim blackListedDomain As String
|
||||||
For Each blackListedDomain In domainInfo.BlackList
|
For Each blackListedDomain In domainInfo.BlackList
|
||||||
|
|
||||||
Dim blacklist As Object = CreateObject(BLACKLIST_PROG_ID)
|
Dim blacklist As New WebsitePanel.Providers.Mail.MailEnableDomainBlacklist
|
||||||
blacklist.Account = domainInfo.Name
|
blacklist.Account = domainInfo.Name
|
||||||
blacklist.Status = 1
|
blacklist.Status = 1
|
||||||
blacklist.TargetDomainName = domainInfo.Name
|
blacklist.TargetDomainName = domainInfo.Name
|
||||||
|
@ -139,7 +128,7 @@ Public Class MailEnable
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Overridable Sub UpdateDomain(ByVal info As MailDomain) Implements IMailServer.UpdateDomain
|
Public Overridable Sub UpdateDomain(ByVal info As MailDomain) Implements IMailServer.UpdateDomain
|
||||||
Dim domain As Object = CreateObject(DOMAIN_PROG_ID)
|
Dim domain As New WebsitePanel.Providers.Mail.MailEnableDomain
|
||||||
domain.AccountName = info.Name
|
domain.AccountName = info.Name
|
||||||
domain.DomainName = info.Name
|
domain.DomainName = info.Name
|
||||||
domain.DomainRedirectionHosts = String.Empty
|
domain.DomainRedirectionHosts = String.Empty
|
||||||
|
@ -161,12 +150,13 @@ Public Class MailEnable
|
||||||
'
|
'
|
||||||
' Update the Catch All Account
|
' Update the Catch All Account
|
||||||
'
|
'
|
||||||
Dim oAddressMap As Object = CreateObject(ADDRESS_MAP_PROG_ID)
|
Dim oAddressMap As New WebsitePanel.Providers.Mail.MailEnableAddressMap
|
||||||
|
|
||||||
oAddressMap.Account = info.Name ' account
|
oAddressMap.Account = info.Name ' account
|
||||||
oAddressMap.DestinationAddress = ""
|
oAddressMap.DestinationAddress = ""
|
||||||
oAddressMap.SourceAddress = "[SMTP:*@" & info.Name & "]"
|
oAddressMap.SourceAddress = "[SMTP:*@" & info.Name & "]"
|
||||||
oAddressMap.Scope = ""
|
oAddressMap.Scope = ""
|
||||||
|
|
||||||
If info.CatchAllAccount = "" Then
|
If info.CatchAllAccount = "" Then
|
||||||
' things are tricky here because we want to change it so we know what we are deleting
|
' things are tricky here because we want to change it so we know what we are deleting
|
||||||
oAddressMap.SourceAddress = "[SMTP:*@" & info.Name & "]"
|
oAddressMap.SourceAddress = "[SMTP:*@" & info.Name & "]"
|
||||||
|
@ -175,7 +165,7 @@ Public Class MailEnable
|
||||||
'
|
'
|
||||||
' Change its value if it exists
|
' Change its value if it exists
|
||||||
'
|
'
|
||||||
If oAddressMap.EditAddressMap(info.Name, "[DELETE:ME]", "[DELETE:ME]", "0") Then
|
If oAddressMap.EditAddressMap(info.Name, "[DELETE:ME]", "[DELETE:ME]", "0", oAddressMap.Status) Then
|
||||||
oAddressMap.Account = info.Name
|
oAddressMap.Account = info.Name
|
||||||
oAddressMap.DestinationAddress = "[DELETE:ME]"
|
oAddressMap.DestinationAddress = "[DELETE:ME]"
|
||||||
oAddressMap.SourceAddress = "[DELETE:ME]"
|
oAddressMap.SourceAddress = "[DELETE:ME]"
|
||||||
|
@ -187,7 +177,8 @@ Public Class MailEnable
|
||||||
Dim NewSourceAddress As String = "[SMTP:*@" & info.Name & "]"
|
Dim NewSourceAddress As String = "[SMTP:*@" & info.Name & "]"
|
||||||
Dim NewDestinationAddress As String = "[SF:" & info.Name & "/" & GetMailboxName(info.CatchAllAccount) & "]"
|
Dim NewDestinationAddress As String = "[SF:" & info.Name & "/" & GetMailboxName(info.CatchAllAccount) & "]"
|
||||||
Dim NewScope As String = "0"
|
Dim NewScope As String = "0"
|
||||||
If oAddressMap.EditAddressMap(NewAccount, NewSourceAddress, NewDestinationAddress, NewScope) <> 1 Then
|
|
||||||
|
If oAddressMap.EditAddressMap(NewAccount, NewSourceAddress, NewDestinationAddress, NewScope, 0) <> 1 Then
|
||||||
'
|
'
|
||||||
' We need to add it because there was not one defined
|
' We need to add it because there was not one defined
|
||||||
'
|
'
|
||||||
|
@ -216,7 +207,7 @@ Public Class MailEnable
|
||||||
Dim NewSourceAddress = "[SMTP:postmaster@" & info.Name & "]"
|
Dim NewSourceAddress = "[SMTP:postmaster@" & info.Name & "]"
|
||||||
Dim NewDestinationAddress = "[SF:" & info.Name & "/" & GetMailboxName(info.PostmasterAccount) & "]"
|
Dim NewDestinationAddress = "[SF:" & info.Name & "/" & GetMailboxName(info.PostmasterAccount) & "]"
|
||||||
Dim NewScope = "0"
|
Dim NewScope = "0"
|
||||||
If oAddressMap.EditAddressMap(NewAccount, NewSourceAddress, NewDestinationAddress, NewScope) <> 1 Then
|
If oAddressMap.EditAddressMap(NewAccount, NewSourceAddress, NewDestinationAddress, NewScope, 0) <> 1 Then
|
||||||
'
|
'
|
||||||
' We need to add it because there was not one defined
|
' We need to add it because there was not one defined
|
||||||
'
|
'
|
||||||
|
@ -245,7 +236,7 @@ Public Class MailEnable
|
||||||
Dim NewSourceAddress = "[SMTP:Abuse@" & info.Name & "]"
|
Dim NewSourceAddress = "[SMTP:Abuse@" & info.Name & "]"
|
||||||
Dim NewDestinationAddress = "[SF:" & info.Name & "/" & GetMailboxName(info.AbuseAccount) & "]"
|
Dim NewDestinationAddress = "[SF:" & info.Name & "/" & GetMailboxName(info.AbuseAccount) & "]"
|
||||||
Dim NewScope = "0"
|
Dim NewScope = "0"
|
||||||
If oAddressMap.EditAddressMap(NewAccount, NewSourceAddress, NewDestinationAddress, NewScope) <> 1 Then
|
If oAddressMap.EditAddressMap(NewAccount, NewSourceAddress, NewDestinationAddress, NewScope, 0) <> 1 Then
|
||||||
'
|
'
|
||||||
' We need to add it because there was not one defined
|
' We need to add it because there was not one defined
|
||||||
'
|
'
|
||||||
|
@ -260,7 +251,7 @@ Public Class MailEnable
|
||||||
|
|
||||||
'edit blacklists
|
'edit blacklists
|
||||||
'delete all the blacklists
|
'delete all the blacklists
|
||||||
Dim blacklist As Object = CreateObject(BLACKLIST_PROG_ID)
|
Dim blacklist As New WebsitePanel.Providers.Mail.MailEnableDomainBlacklist
|
||||||
ResetBlacklist(blacklist)
|
ResetBlacklist(blacklist)
|
||||||
blacklist.Account = info.Name
|
blacklist.Account = info.Name
|
||||||
blacklist.TargetDomainName = info.Name
|
blacklist.TargetDomainName = info.Name
|
||||||
|
@ -270,7 +261,7 @@ Public Class MailEnable
|
||||||
blacklist.RemoveBlacklist()
|
blacklist.RemoveBlacklist()
|
||||||
|
|
||||||
' initialize blacklist again
|
' initialize blacklist again
|
||||||
blacklist = CreateObject(BLACKLIST_PROG_ID)
|
blacklist = New WebsitePanel.Providers.Mail.MailEnableDomainBlacklist
|
||||||
ResetBlacklist(blacklist)
|
ResetBlacklist(blacklist)
|
||||||
blacklist.Account = info.Name
|
blacklist.Account = info.Name
|
||||||
blacklist.TargetDomainName = info.Name
|
blacklist.TargetDomainName = info.Name
|
||||||
|
@ -279,7 +270,7 @@ Public Class MailEnable
|
||||||
'add new blacklists
|
'add new blacklists
|
||||||
Dim blacklistedDomainName As String
|
Dim blacklistedDomainName As String
|
||||||
For Each blacklistedDomainName In info.BlackList
|
For Each blacklistedDomainName In info.BlackList
|
||||||
blacklist = CreateObject(BLACKLIST_PROG_ID)
|
blacklist = New WebsitePanel.Providers.Mail.MailEnableDomainBlacklist
|
||||||
blacklist.Account = info.Name
|
blacklist.Account = info.Name
|
||||||
blacklist.TargetDomainName = info.Name
|
blacklist.TargetDomainName = info.Name
|
||||||
blacklist.BannedDomainName = blacklistedDomainName
|
blacklist.BannedDomainName = blacklistedDomainName
|
||||||
|
@ -294,13 +285,14 @@ Public Class MailEnable
|
||||||
|
|
||||||
Public Overridable Sub DeleteDomain(ByVal domainName As String) Implements IMailServer.DeleteDomain
|
Public Overridable Sub DeleteDomain(ByVal domainName As String) Implements IMailServer.DeleteDomain
|
||||||
'delete all postoffice logins
|
'delete all postoffice logins
|
||||||
Dim login As Object = CreateObject(LOGIN_PROG_ID)
|
Dim login As New WebsitePanel.Providers.Mail.MailEnableLogin
|
||||||
ResetLogin(login)
|
ResetLogin(login)
|
||||||
login.Account = domainName
|
login.Account = domainName
|
||||||
login.RemoveLogin()
|
login.RemoveLogin()
|
||||||
|
|
||||||
'delete all the mailboxes
|
'delete all the mailboxes
|
||||||
Dim mailbox As Object = CreateObject(MAILBOX_PROG_ID)
|
Dim mailbox As New WebsitePanel.Providers.Mail.MailEnableMailbox
|
||||||
|
|
||||||
ResetMailbox(mailbox)
|
ResetMailbox(mailbox)
|
||||||
mailbox.Postoffice = domainName
|
mailbox.Postoffice = domainName
|
||||||
mailbox.RemoveMailbox()
|
mailbox.RemoveMailbox()
|
||||||
|
@ -310,7 +302,7 @@ Public Class MailEnable
|
||||||
Dim list As MailList
|
Dim list As MailList
|
||||||
For Each list In lists
|
For Each list In lists
|
||||||
' remove list members
|
' remove list members
|
||||||
Dim listMember As Object = CreateObject(LIST_MEMBER_PROG_ID)
|
Dim listMember As New WebsitePanel.Providers.Mail.MailEnableListMember
|
||||||
listMember.AccountName = domainName
|
listMember.AccountName = domainName
|
||||||
listMember.ListName = GetMailboxName(list.Name)
|
listMember.ListName = GetMailboxName(list.Name)
|
||||||
listMember.Address = ""
|
listMember.Address = ""
|
||||||
|
@ -319,7 +311,7 @@ Public Class MailEnable
|
||||||
listMember.RemoveListMember()
|
listMember.RemoveListMember()
|
||||||
|
|
||||||
' delete maillist
|
' delete maillist
|
||||||
Dim mailList As Object = CreateObject(MAILLIST_PROG_ID)
|
Dim mailList As New WebsitePanel.Providers.Mail.MailEnableList
|
||||||
ResetMaillist(mailList)
|
ResetMaillist(mailList)
|
||||||
mailList.AccountName = domainName
|
mailList.AccountName = domainName
|
||||||
mailList.ListName = GetMailboxName(list.Name)
|
mailList.ListName = GetMailboxName(list.Name)
|
||||||
|
@ -331,14 +323,14 @@ Public Class MailEnable
|
||||||
Dim group As MailGroup
|
Dim group As MailGroup
|
||||||
For Each group In groups
|
For Each group In groups
|
||||||
' remove group members
|
' remove group members
|
||||||
Dim groupMember As Object = CreateObject(GROUP_MEMBER_PROG_ID)
|
Dim groupMember As New WebsitePanel.Providers.Mail.MailEnableGroupMember
|
||||||
groupMember.Postoffice = domainName
|
groupMember.Postoffice = domainName
|
||||||
groupMember.Mailbox = GetMailboxName(group.Name)
|
groupMember.Mailbox = GetMailboxName(group.Name)
|
||||||
groupMember.Address = ""
|
groupMember.Address = ""
|
||||||
groupMember.RemoveGroupMember()
|
groupMember.RemoveGroupMember()
|
||||||
|
|
||||||
' delete group
|
' delete group
|
||||||
Dim objGroup As Object = CreateObject(GROUP_PROG_ID)
|
Dim objGroup As New WebsitePanel.Providers.Mail.MailEnableGroup
|
||||||
ResetGroup(objGroup)
|
ResetGroup(objGroup)
|
||||||
objGroup.Postoffice = domainName
|
objGroup.Postoffice = domainName
|
||||||
objGroup.GroupName = GetMailboxName(group.Name)
|
objGroup.GroupName = GetMailboxName(group.Name)
|
||||||
|
@ -346,25 +338,25 @@ Public Class MailEnable
|
||||||
Next
|
Next
|
||||||
|
|
||||||
'delete all address mappings
|
'delete all address mappings
|
||||||
Dim map As Object = CreateObject(ADDRESS_MAP_PROG_ID)
|
Dim map As New WebsitePanel.Providers.Mail.MailEnableAddressMap
|
||||||
ResetAddressMap(map)
|
ResetAddressMap(map)
|
||||||
map.Account = domainName
|
map.Account = domainName
|
||||||
map.RemoveAddressMap()
|
map.RemoveAddressMap()
|
||||||
|
|
||||||
'delete all the blacklists
|
'delete all the blacklists
|
||||||
Dim blacklist As Object = CreateObject(BLACKLIST_PROG_ID)
|
Dim blacklist As New WebsitePanel.Providers.Mail.MailEnableDomainBlacklist
|
||||||
ResetBlacklist(blacklist)
|
ResetBlacklist(blacklist)
|
||||||
blacklist.Account = domainName
|
blacklist.Account = domainName
|
||||||
blacklist.RemoveBlacklist()
|
blacklist.RemoveBlacklist()
|
||||||
|
|
||||||
'delete all domains
|
'delete all domains
|
||||||
Dim domain As Object = CreateObject(DOMAIN_PROG_ID)
|
Dim domain As New WebsitePanel.Providers.Mail.MailEnableDomain
|
||||||
ResetDomain(domain)
|
ResetDomain(domain)
|
||||||
domain.AccountName = domainName
|
domain.AccountName = domainName
|
||||||
domain.RemoveDomain()
|
domain.RemoveDomain()
|
||||||
|
|
||||||
'delete postoffice
|
'delete postoffice
|
||||||
Dim po As Object = CreateObject(POSTOFFICE_PROG_ID)
|
Dim po As New WebsitePanel.Providers.Mail.MailEnablePostoffice
|
||||||
po.Account = domainName
|
po.Account = domainName
|
||||||
po.Name = domainName
|
po.Name = domainName
|
||||||
po.Host = ""
|
po.Host = ""
|
||||||
|
@ -390,7 +382,7 @@ Public Class MailEnable
|
||||||
'
|
'
|
||||||
' We need to get the catch all account for the domain
|
' We need to get the catch all account for the domain
|
||||||
'
|
'
|
||||||
Dim oAddressMap As Object = CreateObject(ADDRESS_MAP_PROG_ID)
|
Dim oAddressMap As New WebsitePanel.Providers.Mail.MailEnableAddressMap
|
||||||
oAddressMap.Account = info.Name
|
oAddressMap.Account = info.Name
|
||||||
oAddressMap.DestinationAddress = ""
|
oAddressMap.DestinationAddress = ""
|
||||||
oAddressMap.SourceAddress = "[SMTP:*@" & info.Name & "]"
|
oAddressMap.SourceAddress = "[SMTP:*@" & info.Name & "]"
|
||||||
|
@ -432,7 +424,7 @@ Public Class MailEnable
|
||||||
'getting black mail list
|
'getting black mail list
|
||||||
Dim blacklists As ArrayList = New ArrayList
|
Dim blacklists As ArrayList = New ArrayList
|
||||||
|
|
||||||
Dim blacklist As Object = CreateObject(BLACKLIST_PROG_ID)
|
Dim blacklist As New WebsitePanel.Providers.Mail.MailEnableDomainBlacklist
|
||||||
blacklist.Account = domain.AccountName
|
blacklist.Account = domain.AccountName
|
||||||
blacklist.Host = domain.Host
|
blacklist.Host = domain.Host
|
||||||
blacklist.TargetDomainName = domain.DomainName
|
blacklist.TargetDomainName = domain.DomainName
|
||||||
|
@ -461,7 +453,7 @@ Public Class MailEnable
|
||||||
|
|
||||||
#Region "Domain Aliases"
|
#Region "Domain Aliases"
|
||||||
Public Overridable Function DomainAliasExists(ByVal domainName As String, ByVal aliasName As String) As Boolean Implements IMailServer.DomainAliasExists
|
Public Overridable Function DomainAliasExists(ByVal domainName As String, ByVal aliasName As String) As Boolean Implements IMailServer.DomainAliasExists
|
||||||
Dim domain As Object = CreateObject(DOMAIN_PROG_ID)
|
Dim domain As New WebsitePanel.Providers.Mail.MailEnableDomain
|
||||||
|
|
||||||
ResetDomain(domain)
|
ResetDomain(domain)
|
||||||
domain.AccountName = domainName
|
domain.AccountName = domainName
|
||||||
|
@ -472,7 +464,7 @@ Public Class MailEnable
|
||||||
|
|
||||||
Public Overridable Function GetDomainAliases(ByVal domainName As String) As String() Implements IMailServer.GetDomainAliases
|
Public Overridable Function GetDomainAliases(ByVal domainName As String) As String() Implements IMailServer.GetDomainAliases
|
||||||
Dim aliases As List(Of String) = New List(Of String)
|
Dim aliases As List(Of String) = New List(Of String)
|
||||||
Dim domain As Object = CreateObject(DOMAIN_PROG_ID)
|
Dim domain As New WebsitePanel.Providers.Mail.MailEnableDomain
|
||||||
|
|
||||||
ResetDomain(domain)
|
ResetDomain(domain)
|
||||||
domain.AccountName = domainName
|
domain.AccountName = domainName
|
||||||
|
@ -498,7 +490,7 @@ Public Class MailEnable
|
||||||
|
|
||||||
Public Overridable Sub AddDomainAlias(ByVal domainName As String, ByVal aliasName As String) Implements IMailServer.AddDomainAlias
|
Public Overridable Sub AddDomainAlias(ByVal domainName As String, ByVal aliasName As String) Implements IMailServer.AddDomainAlias
|
||||||
' add new domain
|
' add new domain
|
||||||
Dim domain As Object = CreateObject(DOMAIN_PROG_ID)
|
Dim domain As New WebsitePanel.Providers.Mail.MailEnableDomain
|
||||||
domain.AccountName = domainName
|
domain.AccountName = domainName
|
||||||
domain.DomainName = aliasName
|
domain.DomainName = aliasName
|
||||||
domain.DomainRedirectionHosts = ""
|
domain.DomainRedirectionHosts = ""
|
||||||
|
@ -513,7 +505,7 @@ Public Class MailEnable
|
||||||
' get current "main domain" address mappings
|
' get current "main domain" address mappings
|
||||||
Dim srcAddr As String = "@" + domainName + "]"
|
Dim srcAddr As String = "@" + domainName + "]"
|
||||||
Dim maps As ArrayList = New ArrayList
|
Dim maps As ArrayList = New ArrayList
|
||||||
Dim map As Object = CreateObject(ADDRESS_MAP_PROG_ID)
|
Dim map As New WebsitePanel.Providers.Mail.MailEnableAddressMap
|
||||||
|
|
||||||
ResetAddressMap(map)
|
ResetAddressMap(map)
|
||||||
map.Account = domainName
|
map.Account = domainName
|
||||||
|
@ -545,21 +537,21 @@ Public Class MailEnable
|
||||||
'delete all address mappings
|
'delete all address mappings
|
||||||
Dim addr As String = "@" + aliasName.ToLower() + "]"
|
Dim addr As String = "@" + aliasName.ToLower() + "]"
|
||||||
Dim maps As ArrayList = New ArrayList
|
Dim maps As ArrayList = New ArrayList
|
||||||
Dim map As Object = CreateObject(ADDRESS_MAP_PROG_ID)
|
Dim map As New WebsitePanel.Providers.Mail.MailEnableAddressMap
|
||||||
ResetAddressMap(map)
|
ResetAddressMap(map)
|
||||||
map.Account = domainName
|
map.Account = domainName
|
||||||
map.SourceAddress = "[SMTP:*@" + aliasName + "]"
|
map.SourceAddress = "[SMTP:*@" + aliasName + "]"
|
||||||
map.RemoveAddressMap()
|
map.RemoveAddressMap()
|
||||||
|
|
||||||
'delete all the blacklists
|
'delete all the blacklists
|
||||||
Dim blacklist As Object = CreateObject(BLACKLIST_PROG_ID)
|
Dim blacklist As New WebsitePanel.Providers.Mail.MailEnableDomainBlacklist
|
||||||
ResetBlacklist(blacklist)
|
ResetBlacklist(blacklist)
|
||||||
blacklist.Account = domainName
|
blacklist.Account = domainName
|
||||||
blacklist.TargetDomainName = aliasName
|
blacklist.TargetDomainName = aliasName
|
||||||
blacklist.RemoveBlacklist()
|
blacklist.RemoveBlacklist()
|
||||||
|
|
||||||
'delete all domains
|
'delete all domains
|
||||||
Dim domain As Object = CreateObject(DOMAIN_PROG_ID)
|
Dim domain As New WebsitePanel.Providers.Mail.MailEnableDomain
|
||||||
ResetDomain(domain)
|
ResetDomain(domain)
|
||||||
domain.AccountName = domainName
|
domain.AccountName = domainName
|
||||||
domain.DomainName = aliasName
|
domain.DomainName = aliasName
|
||||||
|
@ -568,11 +560,15 @@ Public Class MailEnable
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Accounts"
|
#Region "Accounts"
|
||||||
|
|
||||||
Public Overridable Function GetAccounts(ByVal domainName As String) As MailAccount() Implements IMailServer.GetAccounts
|
Public Overridable Function GetAccounts(ByVal domainName As String) As MailAccount() Implements IMailServer.GetAccounts
|
||||||
|
|
||||||
Dim mailboxes As List(Of MailAccount) = New List(Of MailAccount)
|
Dim mailboxes As List(Of MailAccount) = New List(Of MailAccount)
|
||||||
Dim mailbox As Object = CreateObject(MAILBOX_PROG_ID)
|
Dim mailbox As New WebsitePanel.Providers.Mail.MailEnableMailbox
|
||||||
|
|
||||||
ResetMailbox(mailbox)
|
ResetMailbox(mailbox)
|
||||||
mailbox.Postoffice = domainName
|
mailbox.Postoffice = domainName
|
||||||
|
mailbox.Size = -4 'we use -4 since this prevents the function from calculating quotas, which is slow
|
||||||
|
|
||||||
If mailbox.FindFirstMailbox() = 1 Then
|
If mailbox.FindFirstMailbox() = 1 Then
|
||||||
Do
|
Do
|
||||||
|
@ -583,6 +579,7 @@ Public Class MailEnable
|
||||||
End If
|
End If
|
||||||
ResetMailbox(mailbox)
|
ResetMailbox(mailbox)
|
||||||
mailbox.Postoffice = domainName
|
mailbox.Postoffice = domainName
|
||||||
|
mailbox.Size = -4
|
||||||
Loop While mailbox.FindNextMailbox() = 1
|
Loop While mailbox.FindNextMailbox() = 1
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
@ -591,10 +588,10 @@ Public Class MailEnable
|
||||||
|
|
||||||
Public Overridable Function GetAccount(ByVal mailboxName As String) As MailAccount Implements IMailServer.GetAccount
|
Public Overridable Function GetAccount(ByVal mailboxName As String) As MailAccount Implements IMailServer.GetAccount
|
||||||
Dim info As MailAccount = Nothing
|
Dim info As MailAccount = Nothing
|
||||||
Dim mailbox As Object = CreateObject(MAILBOX_PROG_ID)
|
Dim mailbox As New WebsitePanel.Providers.Mail.MailEnableMailbox
|
||||||
ResetMailbox(mailbox)
|
ResetMailbox(mailbox)
|
||||||
mailbox.Postoffice = GetDomainName(mailboxName)
|
mailbox.Postoffice = GetDomainName(mailboxName)
|
||||||
mailbox.Mailbox = GetMailboxName(mailboxName)
|
mailbox.MailboxName = GetMailboxName(mailboxName)
|
||||||
|
|
||||||
If (mailbox.GetMailbox() <> 1) Then
|
If (mailbox.GetMailbox() <> 1) Then
|
||||||
Throw New Exception("Could not find the mailbox")
|
Throw New Exception("Could not find the mailbox")
|
||||||
|
@ -607,10 +604,10 @@ Public Class MailEnable
|
||||||
Return info
|
Return info
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function GetMailboxInfo(ByVal mailbox As Object) As MailAccount
|
Private Function GetMailboxInfo(ByVal mailbox As WebsitePanel.Providers.Mail.MailEnableMailbox) As MailAccount
|
||||||
Dim info As MailAccount = New MailAccount
|
Dim info As MailAccount = New MailAccount
|
||||||
info.MaxMailboxSize = IIf(mailbox.Limit = -1, 0, mailbox.Limit / 1024)
|
info.MaxMailboxSize = IIf(mailbox.Limit = -1, 0, mailbox.Limit / 1024)
|
||||||
info.Name = mailbox.Mailbox + "@" + mailbox.Postoffice
|
info.Name = mailbox.MailboxName + "@" + mailbox.Postoffice
|
||||||
|
|
||||||
Dim redirectAddrs As ArrayList = New ArrayList
|
Dim redirectAddrs As ArrayList = New ArrayList
|
||||||
Dim smtpAddress As String
|
Dim smtpAddress As String
|
||||||
|
@ -633,12 +630,12 @@ Public Class MailEnable
|
||||||
info.ResponderMessage = mailbox.GetAutoResponderContents()
|
info.ResponderMessage = mailbox.GetAutoResponderContents()
|
||||||
info.ReplyTo = GetMailBoxReplyToAddress(info.Name)
|
info.ReplyTo = GetMailBoxReplyToAddress(info.Name)
|
||||||
|
|
||||||
Dim map As Object = CreateObject(ADDRESS_MAP_PROG_ID)
|
Dim map As New WebsitePanel.Providers.Mail.MailEnableAddressMap
|
||||||
map.Account = info.Name
|
map.Account = info.Name
|
||||||
map.DestinationAddress = String.Format("[SF:{0}/{1}]", info.Name, info.Name)
|
map.DestinationAddress = String.Format("[SF:{0}/{1}]", info.Name, info.Name)
|
||||||
map.SourceAddress = ""
|
map.SourceAddress = ""
|
||||||
|
|
||||||
Dim login As Object = CreateObject(LOGIN_PROG_ID)
|
Dim login As New WebsitePanel.Providers.Mail.MailEnableLogin
|
||||||
ResetLogin(login)
|
ResetLogin(login)
|
||||||
login.Account = mailbox.Postoffice
|
login.Account = mailbox.Postoffice
|
||||||
login.UserName = info.Name
|
login.UserName = info.Name
|
||||||
|
@ -651,9 +648,9 @@ Public Class MailEnable
|
||||||
Return info
|
Return info
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function GetMailAliasInfo(ByVal mailbox As Object) As MailAlias
|
Private Function GetMailAliasInfo(ByVal mailbox As WebsitePanel.Providers.Mail.MailEnableMailbox) As MailAlias
|
||||||
Dim info As MailAlias = New MailAlias
|
Dim info As MailAlias = New MailAlias
|
||||||
info.Name = mailbox.Mailbox + "@" + mailbox.Postoffice
|
info.Name = mailbox.MailboxName + "@" + mailbox.Postoffice
|
||||||
|
|
||||||
Dim redirectAddrs As ArrayList = New ArrayList
|
Dim redirectAddrs As ArrayList = New ArrayList
|
||||||
Dim smtpAddress As String
|
Dim smtpAddress As String
|
||||||
|
@ -673,12 +670,12 @@ Public Class MailEnable
|
||||||
info.DeleteOnForward = (mailbox.RedirectStatus.Equals(1))
|
info.DeleteOnForward = (mailbox.RedirectStatus.Equals(1))
|
||||||
info.Enabled = (mailbox.Status = 1)
|
info.Enabled = (mailbox.Status = 1)
|
||||||
|
|
||||||
Dim map As Object = CreateObject(ADDRESS_MAP_PROG_ID)
|
Dim map As New WebsitePanel.Providers.Mail.MailEnableAddressMap
|
||||||
map.Account = info.Name
|
map.Account = info.Name
|
||||||
map.DestinationAddress = String.Format("[SF:{0}/{1}]", info.Name, info.Name)
|
map.DestinationAddress = String.Format("[SF:{0}/{1}]", info.Name, info.Name)
|
||||||
map.SourceAddress = ""
|
map.SourceAddress = ""
|
||||||
|
|
||||||
Dim login As Object = CreateObject(LOGIN_PROG_ID)
|
Dim login As New WebsitePanel.Providers.Mail.MailEnableLogin
|
||||||
ResetLogin(login)
|
ResetLogin(login)
|
||||||
login.Account = mailbox.Postoffice
|
login.Account = mailbox.Postoffice
|
||||||
login.UserName = info.Name
|
login.UserName = info.Name
|
||||||
|
@ -692,22 +689,22 @@ Public Class MailEnable
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Overridable Function AccountExists(ByVal mailboxName As String) As Boolean Implements IMailServer.AccountExists
|
Public Overridable Function AccountExists(ByVal mailboxName As String) As Boolean Implements IMailServer.AccountExists
|
||||||
Dim mailbox As Object = CreateObject(MAILBOX_PROG_ID)
|
Dim mailbox As New WebsitePanel.Providers.Mail.MailEnableMailbox
|
||||||
ResetMailbox(mailbox)
|
ResetMailbox(mailbox)
|
||||||
mailbox.Postoffice = GetDomainName(mailboxName)
|
mailbox.Postoffice = GetDomainName(mailboxName)
|
||||||
mailbox.Mailbox = GetMailboxName(mailboxName)
|
mailbox.MailboxName = GetMailboxName(mailboxName)
|
||||||
|
|
||||||
Return (mailbox.GetMailbox() = 1)
|
Return (mailbox.GetMailbox() = 1)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Overridable Sub CreateAccount(ByVal info As MailAccount) Implements IMailServer.CreateAccount
|
Public Overridable Sub CreateAccount(ByVal info As MailAccount) Implements IMailServer.CreateAccount
|
||||||
Dim mailbox As Object = CreateObject(MAILBOX_PROG_ID)
|
Dim mailbox As New WebsitePanel.Providers.Mail.MailEnableMailbox
|
||||||
Dim domainName As String = GetDomainName(info.Name)
|
Dim domainName As String = GetDomainName(info.Name)
|
||||||
Dim mailboxName As String = GetMailboxName(info.Name)
|
Dim mailboxName As String = GetMailboxName(info.Name)
|
||||||
mailbox.Postoffice = domainName
|
mailbox.Postoffice = domainName
|
||||||
|
|
||||||
mailbox.Limit = IIf(info.MaxMailboxSize = 0, -1, info.MaxMailboxSize * 1024) ' convert to kilobytes
|
mailbox.Limit = IIf(info.MaxMailboxSize = 0, -1, info.MaxMailboxSize * 1024) ' convert to kilobytes
|
||||||
mailbox.Mailbox = GetMailboxName(info.Name)
|
mailbox.MailboxName = GetMailboxName(info.Name)
|
||||||
|
|
||||||
If info.ForwardingAddresses Is Nothing Then
|
If info.ForwardingAddresses Is Nothing Then
|
||||||
info.ForwardingAddresses = New String() {}
|
info.ForwardingAddresses = New String() {}
|
||||||
|
@ -749,7 +746,7 @@ Public Class MailEnable
|
||||||
CreateAddressMapsForAllDomains(domainName, mailboxName, destinationAddress)
|
CreateAddressMapsForAllDomains(domainName, mailboxName, destinationAddress)
|
||||||
|
|
||||||
' create login
|
' create login
|
||||||
Dim login As Object = CreateObject(LOGIN_PROG_ID)
|
Dim login As New WebsitePanel.Providers.Mail.MailEnableLogin
|
||||||
login.Account = domainName
|
login.Account = domainName
|
||||||
login.Password = info.Password
|
login.Password = info.Password
|
||||||
login.Status = IIf(info.Enabled, 1, 0)
|
login.Status = IIf(info.Enabled, 1, 0)
|
||||||
|
@ -770,9 +767,9 @@ Public Class MailEnable
|
||||||
Dim domainName As String = GetDomainName(info.Name)
|
Dim domainName As String = GetDomainName(info.Name)
|
||||||
Dim mailboxName As String = GetMailboxName(info.Name)
|
Dim mailboxName As String = GetMailboxName(info.Name)
|
||||||
|
|
||||||
Dim mailbox As Object = CreateObject(MAILBOX_PROG_ID)
|
Dim mailbox As New WebsitePanel.Providers.Mail.MailEnableMailbox
|
||||||
mailbox.Postoffice = domainName
|
mailbox.Postoffice = domainName
|
||||||
mailbox.Mailbox = mailboxName
|
mailbox.MailboxName = mailboxName
|
||||||
|
|
||||||
If info.ForwardingAddresses Is Nothing Then
|
If info.ForwardingAddresses Is Nothing Then
|
||||||
info.ForwardingAddresses = New String() {}
|
info.ForwardingAddresses = New String() {}
|
||||||
|
@ -811,6 +808,8 @@ Public Class MailEnable
|
||||||
|
|
||||||
If (String.IsNullOrEmpty(info.ReplyTo) = False) Then
|
If (String.IsNullOrEmpty(info.ReplyTo) = False) Then
|
||||||
SetMailBoxReplyToAddress(info.Name, info.ReplyTo)
|
SetMailBoxReplyToAddress(info.Name, info.ReplyTo)
|
||||||
|
Else
|
||||||
|
SetMailBoxReplyToAddress(info.Name, "")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
mailbox.SetAutoResponderStatus(info.ResponderEnabled)
|
mailbox.SetAutoResponderStatus(info.ResponderEnabled)
|
||||||
|
@ -824,7 +823,7 @@ Public Class MailEnable
|
||||||
|
|
||||||
' change login password
|
' change login password
|
||||||
If (info.Password.Length > 0) Then
|
If (info.Password.Length > 0) Then
|
||||||
Dim login As Object = CreateObject(LOGIN_PROG_ID)
|
Dim login As New WebsitePanel.Providers.Mail.MailEnableLogin
|
||||||
ResetLogin(login)
|
ResetLogin(login)
|
||||||
login.Account = domainName
|
login.Account = domainName
|
||||||
login.UserName = info.Name
|
login.UserName = info.Name
|
||||||
|
@ -849,17 +848,17 @@ Public Class MailEnable
|
||||||
Dim domainName As String = GetDomainName(name)
|
Dim domainName As String = GetDomainName(name)
|
||||||
Dim mailboxName As String = GetMailboxName(name)
|
Dim mailboxName As String = GetMailboxName(name)
|
||||||
|
|
||||||
Dim mailbox As Object = CreateObject(MAILBOX_PROG_ID)
|
Dim mailbox As New WebsitePanel.Providers.Mail.MailEnableMailbox
|
||||||
ResetMailbox(mailbox)
|
ResetMailbox(mailbox)
|
||||||
mailbox.Postoffice = domainName
|
mailbox.Postoffice = domainName
|
||||||
mailbox.Mailbox = mailboxName
|
mailbox.MailboxName = mailboxName
|
||||||
|
|
||||||
If (mailbox.RemoveMailbox() <> 1) Then
|
If (mailbox.RemoveMailbox() <> 1) Then
|
||||||
Throw New Exception(String.Format("Could not delete mailbox '{0}'", mailboxName))
|
Throw New Exception(String.Format("Could not delete mailbox '{0}'", mailboxName))
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'delete the login for this mailbox
|
'delete the login for this mailbox
|
||||||
Dim login As Object = CreateObject(LOGIN_PROG_ID)
|
Dim login As New WebsitePanel.Providers.Mail.MailEnableLogin
|
||||||
ResetLogin(login)
|
ResetLogin(login)
|
||||||
login.Account = domainName
|
login.Account = domainName
|
||||||
login.UserName = name
|
login.UserName = name
|
||||||
|
@ -870,7 +869,7 @@ Public Class MailEnable
|
||||||
|
|
||||||
|
|
||||||
'delete the address map for this mailbox
|
'delete the address map for this mailbox
|
||||||
Dim map As Object = CreateObject(ADDRESS_MAP_PROG_ID)
|
Dim map As New WebsitePanel.Providers.Mail.MailEnableAddressMap
|
||||||
ResetAddressMap(map)
|
ResetAddressMap(map)
|
||||||
map.Account = domainName
|
map.Account = domainName
|
||||||
map.DestinationAddress = String.Format("[SF:{0}/{1}]", domainName, mailboxName)
|
map.DestinationAddress = String.Format("[SF:{0}/{1}]", domainName, mailboxName)
|
||||||
|
@ -885,10 +884,13 @@ Public Class MailEnable
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function GetMailAliases(ByVal domainName As String) As MailAlias() Implements IMailServer.GetMailAliases
|
Public Function GetMailAliases(ByVal domainName As String) As MailAlias() Implements IMailServer.GetMailAliases
|
||||||
|
|
||||||
Dim mailAliases As List(Of MailAlias) = New List(Of MailAlias)
|
Dim mailAliases As List(Of MailAlias) = New List(Of MailAlias)
|
||||||
Dim mailbox As Object = CreateObject(MAILBOX_PROG_ID)
|
Dim mailbox As New WebsitePanel.Providers.Mail.MailEnableMailbox
|
||||||
|
|
||||||
ResetMailbox(mailbox)
|
ResetMailbox(mailbox)
|
||||||
mailbox.Postoffice = domainName
|
mailbox.Postoffice = domainName
|
||||||
|
mailbox.Size = -4
|
||||||
|
|
||||||
If mailbox.FindFirstMailbox() = 1 Then
|
If mailbox.FindFirstMailbox() = 1 Then
|
||||||
Do
|
Do
|
||||||
|
@ -898,18 +900,20 @@ Public Class MailEnable
|
||||||
End If
|
End If
|
||||||
ResetMailbox(mailbox)
|
ResetMailbox(mailbox)
|
||||||
mailbox.Postoffice = domainName
|
mailbox.Postoffice = domainName
|
||||||
|
mailbox.Size = -4
|
||||||
Loop While mailbox.FindNextMailbox() = 1
|
Loop While mailbox.FindNextMailbox() = 1
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return mailAliases.ToArray()
|
Return mailAliases.ToArray()
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Public Function GetMailAlias(ByVal mailAliasName As String) As MailAlias Implements IMailServer.GetMailAlias
|
Public Function GetMailAlias(ByVal mailAliasName As String) As MailAlias Implements IMailServer.GetMailAlias
|
||||||
Dim info As MailAlias = Nothing
|
Dim info As MailAlias = Nothing
|
||||||
Dim mailAlias As Object = CreateObject(MAILBOX_PROG_ID)
|
Dim mailAlias As New WebsitePanel.Providers.Mail.MailEnableMailbox
|
||||||
ResetMailbox(mailAlias)
|
ResetMailbox(mailAlias)
|
||||||
mailAlias.Postoffice = GetDomainName(mailAliasName)
|
mailAlias.Postoffice = GetDomainName(mailAliasName)
|
||||||
mailAlias.Mailbox = GetMailboxName(mailAliasName)
|
mailAlias.MailboxName = GetMailboxName(mailAliasName)
|
||||||
|
|
||||||
If (mailAlias.GetMailbox() <> 1) Then
|
If (mailAlias.GetMailbox() <> 1) Then
|
||||||
Throw New Exception("Could not find the mailbox")
|
Throw New Exception("Could not find the mailbox")
|
||||||
|
@ -942,7 +946,7 @@ Public Class MailEnable
|
||||||
' ============================
|
' ============================
|
||||||
|
|
||||||
Public Overridable Function GroupExists(ByVal groupName As String) As Boolean Implements IMailServer.GroupExists
|
Public Overridable Function GroupExists(ByVal groupName As String) As Boolean Implements IMailServer.GroupExists
|
||||||
Dim group As Object = CreateObject(GROUP_PROG_ID)
|
Dim group As New WebsitePanel.Providers.Mail.MailEnableGroup
|
||||||
ResetGroup(group)
|
ResetGroup(group)
|
||||||
group.Postoffice = GetDomainName(groupName)
|
group.Postoffice = GetDomainName(groupName)
|
||||||
group.GroupName = GetMailboxName(groupName)
|
group.GroupName = GetMailboxName(groupName)
|
||||||
|
@ -951,7 +955,7 @@ Public Class MailEnable
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Overridable Function GetGroup(ByVal groupName As String) As MailGroup Implements IMailServer.GetGroup
|
Public Overridable Function GetGroup(ByVal groupName As String) As MailGroup Implements IMailServer.GetGroup
|
||||||
Dim objGroup As Object = CreateObject(GROUP_PROG_ID)
|
Dim objGroup As New WebsitePanel.Providers.Mail.MailEnableGroup
|
||||||
ResetGroup(objGroup)
|
ResetGroup(objGroup)
|
||||||
objGroup.Postoffice = GetDomainName(groupName)
|
objGroup.Postoffice = GetDomainName(groupName)
|
||||||
objGroup.GroupName = GetMailboxName(groupName)
|
objGroup.GroupName = GetMailboxName(groupName)
|
||||||
|
@ -966,7 +970,7 @@ Public Class MailEnable
|
||||||
Public Overridable Function GetGroups(ByVal domainName As String) As MailGroup() Implements IMailServer.GetGroups
|
Public Overridable Function GetGroups(ByVal domainName As String) As MailGroup() Implements IMailServer.GetGroups
|
||||||
Dim groups As List(Of MailGroup) = New List(Of MailGroup)
|
Dim groups As List(Of MailGroup) = New List(Of MailGroup)
|
||||||
|
|
||||||
Dim objGroup As Object = CreateObject(GROUP_PROG_ID)
|
Dim objGroup As New WebsitePanel.Providers.Mail.MailEnableGroup
|
||||||
ResetGroup(objGroup)
|
ResetGroup(objGroup)
|
||||||
objGroup.Postoffice = domainName
|
objGroup.Postoffice = domainName
|
||||||
|
|
||||||
|
@ -992,7 +996,7 @@ Public Class MailEnable
|
||||||
group.Members = New String() {}
|
group.Members = New String() {}
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim objGroup As Object = CreateObject(GROUP_PROG_ID)
|
Dim objGroup As New WebsitePanel.Providers.Mail.MailEnableGroup
|
||||||
ResetGroup(objGroup)
|
ResetGroup(objGroup)
|
||||||
|
|
||||||
objGroup.Postoffice = domainName
|
objGroup.Postoffice = domainName
|
||||||
|
@ -1007,7 +1011,7 @@ Public Class MailEnable
|
||||||
' add group members
|
' add group members
|
||||||
Dim member As String
|
Dim member As String
|
||||||
For Each member In group.Members
|
For Each member In group.Members
|
||||||
Dim groupMember As Object = CreateObject(GROUP_MEMBER_PROG_ID)
|
Dim groupMember As New WebsitePanel.Providers.Mail.MailEnableGroupMember
|
||||||
groupMember.Postoffice = domainName
|
groupMember.Postoffice = domainName
|
||||||
groupMember.Address = String.Format("[SMTP:{0}]", member)
|
groupMember.Address = String.Format("[SMTP:{0}]", member)
|
||||||
groupMember.Mailbox = groupName
|
groupMember.Mailbox = groupName
|
||||||
|
@ -1028,7 +1032,7 @@ Public Class MailEnable
|
||||||
group.Members = New String() {}
|
group.Members = New String() {}
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim objGroup As Object = CreateObject(GROUP_PROG_ID)
|
Dim objGroup As New WebsitePanel.Providers.Mail.MailEnableGroup
|
||||||
ResetGroup(objGroup)
|
ResetGroup(objGroup)
|
||||||
|
|
||||||
objGroup.Postoffice = domainName
|
objGroup.Postoffice = domainName
|
||||||
|
@ -1046,7 +1050,7 @@ Public Class MailEnable
|
||||||
IIf(group.Enabled, 1, 0))
|
IIf(group.Enabled, 1, 0))
|
||||||
|
|
||||||
'delete group members
|
'delete group members
|
||||||
Dim objMember As Object = CreateObject(GROUP_MEMBER_PROG_ID)
|
Dim objMember As New WebsitePanel.Providers.Mail.MailEnableGroupMember
|
||||||
objMember.Postoffice = domainName
|
objMember.Postoffice = domainName
|
||||||
objMember.Mailbox = groupName
|
objMember.Mailbox = groupName
|
||||||
objMember.Address = ""
|
objMember.Address = ""
|
||||||
|
@ -1055,7 +1059,7 @@ Public Class MailEnable
|
||||||
' add group members
|
' add group members
|
||||||
Dim member As String
|
Dim member As String
|
||||||
For Each member In group.Members
|
For Each member In group.Members
|
||||||
Dim groupMember As Object = CreateObject(GROUP_MEMBER_PROG_ID)
|
Dim groupMember As New WebsitePanel.Providers.Mail.MailEnableGroupMember
|
||||||
groupMember.Postoffice = domainName
|
groupMember.Postoffice = domainName
|
||||||
groupMember.Address = String.Format("[SMTP:{0}]", member)
|
groupMember.Address = String.Format("[SMTP:{0}]", member)
|
||||||
groupMember.Mailbox = groupName
|
groupMember.Mailbox = groupName
|
||||||
|
@ -1071,21 +1075,21 @@ Public Class MailEnable
|
||||||
Dim groupName As String = GetMailboxName(name)
|
Dim groupName As String = GetMailboxName(name)
|
||||||
|
|
||||||
' remove group
|
' remove group
|
||||||
Dim objGroup As Object = CreateObject(GROUP_PROG_ID)
|
Dim objGroup As New WebsitePanel.Providers.Mail.MailEnableGroup
|
||||||
ResetGroup(objGroup)
|
ResetGroup(objGroup)
|
||||||
objGroup.Postoffice = domainName
|
objGroup.Postoffice = domainName
|
||||||
objGroup.GroupName = groupName
|
objGroup.GroupName = groupName
|
||||||
objGroup.RemoveGroup()
|
objGroup.RemoveGroup()
|
||||||
|
|
||||||
'delete group members
|
'delete group members
|
||||||
Dim objMember As Object = CreateObject(GROUP_MEMBER_PROG_ID)
|
Dim objMember As New WebsitePanel.Providers.Mail.MailEnableGroupMember
|
||||||
objMember.Postoffice = domainName
|
objMember.Postoffice = domainName
|
||||||
objMember.Mailbox = groupName
|
objMember.Mailbox = groupName
|
||||||
objMember.Address = ""
|
objMember.Address = ""
|
||||||
objMember.RemoveGroupMember()
|
objMember.RemoveGroupMember()
|
||||||
|
|
||||||
' delete address maps
|
' delete address maps
|
||||||
Dim map As Object = CreateObject(ADDRESS_MAP_PROG_ID)
|
Dim map As New WebsitePanel.Providers.Mail.MailEnableAddressMap
|
||||||
ResetAddressMap(map)
|
ResetAddressMap(map)
|
||||||
map.Account = domainName
|
map.Account = domainName
|
||||||
map.DestinationAddress = String.Format("[SF:{0}/{1}]", domainName, groupName)
|
map.DestinationAddress = String.Format("[SF:{0}/{1}]", domainName, groupName)
|
||||||
|
@ -1096,7 +1100,7 @@ Public Class MailEnable
|
||||||
#Region "Lists"
|
#Region "Lists"
|
||||||
|
|
||||||
Public Overridable Function GetList(ByVal maillistName As String) As MailList Implements IMailServer.GetList
|
Public Overridable Function GetList(ByVal maillistName As String) As MailList Implements IMailServer.GetList
|
||||||
Dim mailList As Object = CreateObject(MAILLIST_PROG_ID)
|
Dim mailList As New WebsitePanel.Providers.Mail.MailEnableList
|
||||||
ResetMaillist(mailList)
|
ResetMaillist(mailList)
|
||||||
mailList.AccountName = GetDomainName(maillistName)
|
mailList.AccountName = GetDomainName(maillistName)
|
||||||
mailList.ListName = GetMailboxName(maillistName)
|
mailList.ListName = GetMailboxName(maillistName)
|
||||||
|
@ -1112,7 +1116,7 @@ Public Class MailEnable
|
||||||
Dim maillists As List(Of MailList) = New List(Of MailList)
|
Dim maillists As List(Of MailList) = New List(Of MailList)
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim mailList As Object = CreateObject(MAILLIST_PROG_ID)
|
Dim mailList As New WebsitePanel.Providers.Mail.MailEnableList
|
||||||
ResetMaillist(mailList)
|
ResetMaillist(mailList)
|
||||||
mailList.AccountName = domainName
|
mailList.AccountName = domainName
|
||||||
|
|
||||||
|
@ -1165,7 +1169,7 @@ Public Class MailEnable
|
||||||
Dim domainName As String = GetDomainName(name)
|
Dim domainName As String = GetDomainName(name)
|
||||||
Dim mailListName As String = GetMailboxName(name)
|
Dim mailListName As String = GetMailboxName(name)
|
||||||
|
|
||||||
Dim listMember As Object = CreateObject(LIST_MEMBER_PROG_ID)
|
Dim listMember As New WebsitePanel.Providers.Mail.MailEnableListMember
|
||||||
listMember.AccountName = domainName
|
listMember.AccountName = domainName
|
||||||
listMember.ListName = mailListName
|
listMember.ListName = mailListName
|
||||||
listMember.Address = ""
|
listMember.Address = ""
|
||||||
|
@ -1192,7 +1196,7 @@ Public Class MailEnable
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Overridable Function ListExists(ByVal maillistName As String) As Boolean Implements IMailServer.ListExists
|
Public Overridable Function ListExists(ByVal maillistName As String) As Boolean Implements IMailServer.ListExists
|
||||||
Dim mailList As Object = CreateObject(MAILLIST_PROG_ID)
|
Dim mailList As New WebsitePanel.Providers.Mail.MailEnableList
|
||||||
ResetMaillist(mailList)
|
ResetMaillist(mailList)
|
||||||
mailList.AccountName = GetDomainName(maillistName)
|
mailList.AccountName = GetDomainName(maillistName)
|
||||||
mailList.ListName = GetMailboxName(maillistName)
|
mailList.ListName = GetMailboxName(maillistName)
|
||||||
|
@ -1210,7 +1214,7 @@ Public Class MailEnable
|
||||||
info.Members = New String() {}
|
info.Members = New String() {}
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim mailList As Object = CreateObject(MAILLIST_PROG_ID)
|
Dim mailList As New WebsitePanel.Providers.Mail.MailEnableList
|
||||||
ResetMaillist(mailList)
|
ResetMaillist(mailList)
|
||||||
|
|
||||||
mailList.AccountName = domainName
|
mailList.AccountName = domainName
|
||||||
|
@ -1239,7 +1243,7 @@ Public Class MailEnable
|
||||||
'create mail list members
|
'create mail list members
|
||||||
Dim member As String
|
Dim member As String
|
||||||
For Each member In info.Members
|
For Each member In info.Members
|
||||||
Dim listMember As Object = CreateObject(LIST_MEMBER_PROG_ID)
|
Dim listMember As New WebsitePanel.Providers.Mail.MailEnableListMember
|
||||||
listMember.AccountName = domainName
|
listMember.AccountName = domainName
|
||||||
listMember.Address = String.Format("[SMTP:{0}]", member)
|
listMember.Address = String.Format("[SMTP:{0}]", member)
|
||||||
listMember.ListMemberType = 0
|
listMember.ListMemberType = 0
|
||||||
|
@ -1265,7 +1269,7 @@ Public Class MailEnable
|
||||||
info.Members = New String() {}
|
info.Members = New String() {}
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim mailList As Object = CreateObject(MAILLIST_PROG_ID)
|
Dim mailList As New WebsitePanel.Providers.Mail.MailEnableList
|
||||||
ResetMaillist(mailList)
|
ResetMaillist(mailList)
|
||||||
|
|
||||||
mailList.AccountName = domainName
|
mailList.AccountName = domainName
|
||||||
|
@ -1318,7 +1322,7 @@ Public Class MailEnable
|
||||||
-1)
|
-1)
|
||||||
|
|
||||||
'delete list members
|
'delete list members
|
||||||
Dim listMember As Object = CreateObject(LIST_MEMBER_PROG_ID)
|
Dim listMember As New WebsitePanel.Providers.Mail.MailEnableListMember
|
||||||
listMember.AccountName = domainName
|
listMember.AccountName = domainName
|
||||||
listMember.ListName = maillistName
|
listMember.ListName = maillistName
|
||||||
listMember.Address = ""
|
listMember.Address = ""
|
||||||
|
@ -1329,7 +1333,7 @@ Public Class MailEnable
|
||||||
'create mail list members
|
'create mail list members
|
||||||
Dim member As String
|
Dim member As String
|
||||||
For Each member In info.Members
|
For Each member In info.Members
|
||||||
listMember = CreateObject(LIST_MEMBER_PROG_ID)
|
listMember = New WebsitePanel.Providers.Mail.MailEnableListMember
|
||||||
listMember.AccountName = domainName
|
listMember.AccountName = domainName
|
||||||
listMember.ListName = maillistName
|
listMember.ListName = maillistName
|
||||||
listMember.Address = String.Format("[SMTP:{0}]", member)
|
listMember.Address = String.Format("[SMTP:{0}]", member)
|
||||||
|
@ -1353,14 +1357,14 @@ Public Class MailEnable
|
||||||
Dim maillistName As String = GetMailboxName(name)
|
Dim maillistName As String = GetMailboxName(name)
|
||||||
|
|
||||||
' remove mailing list
|
' remove mailing list
|
||||||
Dim mailList As Object = CreateObject(MAILLIST_PROG_ID)
|
Dim mailList As New WebsitePanel.Providers.Mail.MailEnableList
|
||||||
ResetMaillist(mailList)
|
ResetMaillist(mailList)
|
||||||
mailList.ListName = maillistName
|
mailList.ListName = maillistName
|
||||||
mailList.AccountName = domainName
|
mailList.AccountName = domainName
|
||||||
mailList.RemoveList()
|
mailList.RemoveList()
|
||||||
|
|
||||||
' delete list members
|
' delete list members
|
||||||
Dim listMember As Object = CreateObject(LIST_MEMBER_PROG_ID)
|
Dim listMember As New WebsitePanel.Providers.Mail.MailEnableListMember
|
||||||
listMember.AccountName = domainName
|
listMember.AccountName = domainName
|
||||||
listMember.ListName = maillistName
|
listMember.ListName = maillistName
|
||||||
listMember.Address = ""
|
listMember.Address = ""
|
||||||
|
@ -1370,7 +1374,7 @@ Public Class MailEnable
|
||||||
listMember.RemoveListMember()
|
listMember.RemoveListMember()
|
||||||
|
|
||||||
' delete address maps
|
' delete address maps
|
||||||
Dim map As Object = CreateObject(ADDRESS_MAP_PROG_ID)
|
Dim map As New WebsitePanel.Providers.Mail.MailEnableAddressMap
|
||||||
ResetAddressMap(map)
|
ResetAddressMap(map)
|
||||||
map.Account = domainName
|
map.Account = domainName
|
||||||
map.DestinationAddress = String.Format("[LS:{0}/{1}]", domainName, maillistName)
|
map.DestinationAddress = String.Format("[LS:{0}/{1}]", domainName, maillistName)
|
||||||
|
@ -1415,10 +1419,10 @@ Public Class MailEnable
|
||||||
login.Status = -1
|
login.Status = -1
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub ResetMailbox(ByVal mailbox As Object)
|
Private Sub ResetMailbox(ByVal mailbox As WebsitePanel.Providers.Mail.MailEnableMailbox)
|
||||||
mailbox.Postoffice = ""
|
mailbox.Postoffice = ""
|
||||||
mailbox.Host = ""
|
mailbox.Host = ""
|
||||||
mailbox.Mailbox = ""
|
mailbox.MailboxName = ""
|
||||||
mailbox.RedirectAddress = ""
|
mailbox.RedirectAddress = ""
|
||||||
mailbox.Limit = -1
|
mailbox.Limit = -1
|
||||||
mailbox.RedirectStatus = -1
|
mailbox.RedirectStatus = -1
|
||||||
|
@ -1495,7 +1499,7 @@ Public Class MailEnable
|
||||||
Dim domainName As String = GetDomainName(name)
|
Dim domainName As String = GetDomainName(name)
|
||||||
Dim groupName As String = GetMailboxName(name)
|
Dim groupName As String = GetMailboxName(name)
|
||||||
|
|
||||||
Dim groupMember As Object = CreateObject(GROUP_MEMBER_PROG_ID)
|
Dim groupMember As New WebsitePanel.Providers.Mail.MailEnableGroupMember
|
||||||
groupMember.Postoffice = domainName
|
groupMember.Postoffice = domainName
|
||||||
groupMember.Mailbox = groupName
|
groupMember.Mailbox = groupName
|
||||||
groupMember.Address = ""
|
groupMember.Address = ""
|
||||||
|
@ -1516,8 +1520,8 @@ Public Class MailEnable
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Sub CreateAddressMapsForAllDomains(ByVal domainName As String, ByVal aliasName As String, ByVal targetAddress As String)
|
Private Sub CreateAddressMapsForAllDomains(ByVal domainName As String, ByVal aliasName As String, ByVal targetAddress As String)
|
||||||
Dim oDomain As Object = CreateObject(DOMAIN_PROG_ID)
|
Dim oDomain As New WebsitePanel.Providers.Mail.MailEnableDomain
|
||||||
Dim oAddressMap As Object = CreateObject(ADDRESS_MAP_PROG_ID)
|
Dim oAddressMap As New WebsitePanel.Providers.Mail.MailEnableAddressMap
|
||||||
oDomain.AccountName = domainName
|
oDomain.AccountName = domainName
|
||||||
oDomain.DomainName = ""
|
oDomain.DomainName = ""
|
||||||
oDomain.Status = -1
|
oDomain.Status = -1
|
||||||
|
@ -1772,87 +1776,60 @@ Public Class MailEnable
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub SetMailBoxReplyToAddress(ByVal mailbox As String, ByVal replyToAddress As String)
|
Private Sub SetMailBoxReplyToAddress(ByVal mailbox As String, ByVal replyToAddress As String)
|
||||||
Dim mailBoxFile As String = String.Format("Config\PostOffices\{0}\MAILBOXES\{1}.sys", GetDomainName(mailbox), GetMailboxName(mailbox))
|
|
||||||
Dim mailboxPath As String = Path.Combine(GetInstallPath(), mailBoxFile)
|
|
||||||
|
|
||||||
If (File.Exists(mailboxPath) <> True) Then
|
Dim oMEAOSO As New WebsitePanel.Providers.Mail.MailEnableOption
|
||||||
Dim stream As New IO.FileStream(mailboxPath, IO.FileMode.OpenOrCreate, IO.FileAccess.ReadWrite, IO.FileShare.None)
|
|
||||||
Dim writer As New StreamWriter(stream)
|
|
||||||
writer.WriteLine("[General]")
|
|
||||||
writer.Dispose()
|
|
||||||
stream.Dispose()
|
|
||||||
End If
|
|
||||||
|
|
||||||
Dim reader As New StreamReader(mailboxPath)
|
With oMEAOSO
|
||||||
|
.Scope = 2
|
||||||
|
.Query = GetDomainName(mailbox) & "/" & GetMailboxName(mailbox)
|
||||||
|
.ValueName = "ReplyAddress"
|
||||||
|
.Value = replyToAddress
|
||||||
|
.SetOption()
|
||||||
|
End With
|
||||||
|
|
||||||
Dim Count As Integer = 0
|
|
||||||
While reader.Peek <> -1
|
|
||||||
Dim line As String = reader.ReadLine()
|
|
||||||
If line.Contains("ReplyAddress") Then
|
|
||||||
reader.Dispose()
|
|
||||||
ReplaceLine(mailboxPath, Count, String.Format("ReplyAddress={0}", replyToAddress))
|
|
||||||
Exit Sub
|
|
||||||
End If
|
|
||||||
Count = Count + 1
|
|
||||||
End While
|
|
||||||
|
|
||||||
reader.Dispose()
|
|
||||||
AppendLine(mailboxPath, String.Format("ReplyAddress={0}", replyToAddress))
|
|
||||||
|
|
||||||
'Dim writer As New StreamWriter(mailboxPath)
|
|
||||||
'writer.WriteLine(String.Format("ReplyAddress={0}", replyToAddress))
|
|
||||||
'writer.Close()
|
|
||||||
'writer.Dispose()
|
|
||||||
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
|
|
||||||
Private Sub ReplaceLine(ByRef FileAddress As String, ByRef line As Integer, ByVal address As String)
|
|
||||||
Dim TheFileLines As New List(Of String)
|
|
||||||
TheFileLines.AddRange(System.IO.File.ReadAllLines(FileAddress))
|
|
||||||
If line >= TheFileLines.Count Then Exit Sub
|
|
||||||
TheFileLines.RemoveAt(line)
|
|
||||||
TheFileLines.Add(address)
|
|
||||||
File.WriteAllLines(FileAddress, TheFileLines.ToArray)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub AppendLine(ByRef FileAddress As String, ByRef line As String)
|
|
||||||
Dim TheFileLines As New List(Of String)
|
|
||||||
TheFileLines.AddRange(System.IO.File.ReadAllLines(FileAddress))
|
|
||||||
TheFileLines.Add(line)
|
|
||||||
File.WriteAllLines(FileAddress, TheFileLines.ToArray)
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function GetMailBoxReplyToAddress(ByVal mailbox As String)
|
Private Function GetMailBoxReplyToAddress(ByVal mailbox As String)
|
||||||
Dim mailBoxFile As String = String.Format("Config\PostOffices\{0}\MAILBOXES\{1}.sys", GetDomainName(mailbox), GetMailboxName(mailbox))
|
|
||||||
Dim mailboxPath As String = Path.Combine(GetInstallPath(), mailBoxFile)
|
|
||||||
|
|
||||||
If (File.Exists(mailboxPath) = False) Then
|
Dim oMEAOSO As New WebsitePanel.Providers.Mail.MailEnableOption
|
||||||
Return String.Empty
|
|
||||||
End If
|
|
||||||
|
|
||||||
Dim reader As New StreamReader(mailboxPath)
|
With oMEAOSO
|
||||||
|
.Scope = 2
|
||||||
|
.Query = GetDomainName(mailbox) & "/" & GetMailboxName(mailbox)
|
||||||
|
.ValueName = "ReplyAddress"
|
||||||
|
.GetOption()
|
||||||
|
Return .Value
|
||||||
|
End With
|
||||||
|
|
||||||
While reader.Peek <> -1
|
|
||||||
Dim line As String = reader.ReadLine()
|
|
||||||
If line.Contains("ReplyAddress") Then
|
|
||||||
Dim split As String() = line.Split(New [Char]() {"="c})
|
|
||||||
Return split(1)
|
|
||||||
End If
|
|
||||||
End While
|
|
||||||
reader.Dispose()
|
|
||||||
Return String.Empty
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function GetPostofficesPath() As String
|
Function GetMailEnableRegistryItem(item As String) As String
|
||||||
Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Mail Enable\Mail Enable")
|
|
||||||
Return CStr(key.GetValue("Mail Root"))
|
Dim key As RegistryKey
|
||||||
|
|
||||||
|
If IntPtr.Size > 4 Then
|
||||||
|
key = Registry.LocalMachine.OpenSubKey("SOFTWARE\Wow6432Node\Mail Enable\Mail Enable")
|
||||||
|
Else
|
||||||
|
key = Registry.LocalMachine.OpenSubKey("SOFTWARE\Mail Enable\Mail Enable")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return CStr(key.GetValue(item))
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Shared Function GetPostofficesPath() As String
|
||||||
|
|
||||||
|
Dim oLocal As New MailEnable
|
||||||
|
Return oLocal.GetMailEnableRegistryItem("Mail Root")
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Private Function GetInstallPath() As String
|
Private Function GetInstallPath() As String
|
||||||
Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Mail Enable\Mail Enable")
|
|
||||||
Return CStr(key.GetValue("Program Directory"))
|
Return GetMailEnableRegistryItem("Program Directory")
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
@ -1970,6 +1947,20 @@ Public Class MailEnable
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function NonCString(ByVal InString As String) As String
|
||||||
|
Dim NTPos As Integer
|
||||||
|
NTPos = InStr(1, InString, Chr(0), CompareMethod.Binary)
|
||||||
|
If NTPos > 0 Then
|
||||||
|
NonCString = Left(InString, NTPos - 1)
|
||||||
|
Else
|
||||||
|
NonCString = InString
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function CString(ByVal InString As String) As String
|
||||||
|
CString = InString & Chr(0)
|
||||||
|
End Function
|
||||||
|
|
||||||
Private Function GetLoggingPath() As String
|
Private Function GetLoggingPath() As String
|
||||||
|
|
||||||
Dim programPath As String = ""
|
Dim programPath As String = ""
|
||||||
|
@ -1986,36 +1977,31 @@ Public Class MailEnable
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Public Overrides Function IsInstalled() As Boolean
|
Public Overrides Function IsInstalled() As Boolean
|
||||||
|
|
||||||
Dim version As String = ""
|
Dim version As String = ""
|
||||||
Dim key32bit As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Mail Enable\Mail Enable")
|
Dim key As RegistryKey
|
||||||
If (key32bit Is Nothing) Then
|
|
||||||
Dim key64bit As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Wow6432Node\Mail Enable\Mail Enable")
|
If IntPtr.Size > 4 Then
|
||||||
If (key64bit Is Nothing) Then
|
key = Registry.LocalMachine.OpenSubKey("SOFTWARE\Wow6432Node\Mail Enable\Mail Enable")
|
||||||
Return False
|
|
||||||
Else
|
Else
|
||||||
version = CStr(key64bit.GetValue("Enterprise Version"))
|
key = Registry.LocalMachine.OpenSubKey("SOFTWARE\Mail Enable\Mail Enable")
|
||||||
|
End If
|
||||||
|
|
||||||
|
version = CStr(key.GetValue("Enterprise Version"))
|
||||||
If (version Is Nothing) Then
|
If (version Is Nothing) Then
|
||||||
version = CStr(key64bit.GetValue("Version"))
|
version = CStr(key.GetValue("Version"))
|
||||||
If (version Is Nothing Or version.Equals("0")) Then
|
If (version Is Nothing Or version.Equals("0")) Then
|
||||||
version = CStr(key64bit.GetValue("Professional Version"))
|
version = CStr(key.GetValue("Professional Version"))
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
version = CStr(key32bit.GetValue("Enterprise Version"))
|
|
||||||
If (version Is Nothing) Then
|
|
||||||
version = CStr(key32bit.GetValue("Version"))
|
|
||||||
If (version Is Nothing Or version.Equals("0")) Then
|
|
||||||
version = CStr(key32bit.GetValue("Professional Version"))
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If [String].IsNullOrEmpty(version) = False Then
|
If [String].IsNullOrEmpty(version) = False Then
|
||||||
Dim split As String() = version.Split(New [Char]() {"."c})
|
Dim split As String() = version.Split(New [Char]() {"."c})
|
||||||
Return split(0).Equals("1") Or split(0).Equals("2") Or split(0).Equals("3") Or split(0).Equals("4")
|
Return split(0).Equals("1") Or split(0).Equals("2") Or split(0).Equals("3") Or split(0).Equals("4") Or split(0).Equals("5") Or split(0).Equals("6")
|
||||||
Else
|
Else
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue