Configuration classes needed for accessing MailEnable API from .Net.
This commit is contained in:
parent
ae306ab633
commit
c28faf43ce
11 changed files with 3428 additions and 0 deletions
|
@ -0,0 +1,233 @@
|
|||
Option Strict Off
|
||||
Option Explicit On
|
||||
|
||||
Namespace WebsitePanel.Providers.Mail
|
||||
Public Class MailEnableAddressMap
|
||||
Inherits MarshalByRefObject
|
||||
|
||||
Private AccountVal As String = ""
|
||||
Private SourceAddressVal As String = ""
|
||||
Private DestinationAddressVal As String = ""
|
||||
Private ScopeVal As String = ""
|
||||
Private HostVal As String = ""
|
||||
Private StatusVal As Integer
|
||||
|
||||
Private Structure IADDRESSMAPENTRYTYPE
|
||||
<VBFixedString(1024), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=1024)> Public Account As String
|
||||
<VBFixedString(1024), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=1024)> Public SourceAddress As String
|
||||
<VBFixedString(1024), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=1024)> Public DestinationAddress As String
|
||||
<VBFixedString(1024), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=1024)> Public Scope As String
|
||||
Public Status As Integer
|
||||
End Structure
|
||||
|
||||
Private Declare Function AddressMapGet Lib "MEAIAM.DLL" (ByRef lpAddressMap As IADDRESSMAPENTRYTYPE) As Integer
|
||||
Private Declare Function AddressMapFindFirst Lib "MEAIAM.DLL" (ByRef lpAddressMap As IADDRESSMAPENTRYTYPE) As Integer
|
||||
Private Declare Function AddressMapFindNext Lib "MEAIAM.DLL" (ByRef lpAddressMap As IADDRESSMAPENTRYTYPE) As Integer
|
||||
Private Declare Function AddressMapAdd Lib "MEAIAM.DLL" (ByRef lpAddressMap As IADDRESSMAPENTRYTYPE) As Integer
|
||||
Private Declare Function AddressMapEdit Lib "MEAIAM.DLL" (ByRef TargetAddressMap As IADDRESSMAPENTRYTYPE, ByRef NewAddressMap As IADDRESSMAPENTRYTYPE) As Integer
|
||||
Private Declare Function AddressMapRemove Lib "MEAIAM.DLL" (ByRef lpAddressMap As IADDRESSMAPENTRYTYPE) As Integer
|
||||
Private Declare Function SetCurrentHost Lib "MEAIAM.DLL" (ByVal CurrentHost As String) As Integer
|
||||
|
||||
Public Function SetHost() As Integer
|
||||
SetHost = SetCurrentHost(Host)
|
||||
End Function
|
||||
|
||||
Public Function GetAddressMap() As Integer
|
||||
|
||||
Dim CAddressMap As IADDRESSMAPENTRYTYPE
|
||||
|
||||
CAddressMap.Account = Account
|
||||
CAddressMap.SourceAddress = SourceAddress
|
||||
CAddressMap.DestinationAddress = DestinationAddress
|
||||
CAddressMap.Scope = Scope
|
||||
CAddressMap.Status = Status
|
||||
GetAddressMap = AddressMapGet(CAddressMap)
|
||||
Account = CAddressMap.Account
|
||||
SourceAddress = CAddressMap.SourceAddress
|
||||
DestinationAddress = CAddressMap.DestinationAddress
|
||||
Scope = CAddressMap.Scope
|
||||
Status = CAddressMap.Status
|
||||
End Function
|
||||
|
||||
Public Function FindFirstAddressMap() As Integer
|
||||
Dim CAddressMap As IADDRESSMAPENTRYTYPE
|
||||
CAddressMap.Account = Account
|
||||
CAddressMap.SourceAddress = SourceAddress
|
||||
CAddressMap.DestinationAddress = DestinationAddress
|
||||
CAddressMap.Scope = Scope
|
||||
CAddressMap.Status = Status
|
||||
FindFirstAddressMap = AddressMapFindFirst(CAddressMap)
|
||||
Account = CAddressMap.Account
|
||||
SourceAddress = CAddressMap.SourceAddress
|
||||
DestinationAddress = CAddressMap.DestinationAddress
|
||||
Scope = CAddressMap.Scope
|
||||
Status = CAddressMap.Status
|
||||
End Function
|
||||
|
||||
Public Function FindNextAddressMap() As Integer
|
||||
Dim CAddressMap As IADDRESSMAPENTRYTYPE
|
||||
CAddressMap.Account = Account
|
||||
CAddressMap.SourceAddress = SourceAddress
|
||||
CAddressMap.DestinationAddress = DestinationAddress
|
||||
CAddressMap.Scope = Scope
|
||||
CAddressMap.Status = Status
|
||||
FindNextAddressMap = AddressMapFindNext(CAddressMap)
|
||||
Account = CAddressMap.Account
|
||||
SourceAddress = CAddressMap.SourceAddress
|
||||
DestinationAddress = CAddressMap.DestinationAddress
|
||||
Scope = CAddressMap.Scope
|
||||
Status = CAddressMap.Status
|
||||
End Function
|
||||
|
||||
Public Function AddAddressMap() As Integer
|
||||
Dim CAddressMap As IADDRESSMAPENTRYTYPE
|
||||
CAddressMap.Account = Account
|
||||
CAddressMap.SourceAddress = SourceAddress
|
||||
CAddressMap.DestinationAddress = DestinationAddress
|
||||
CAddressMap.Scope = Scope
|
||||
CAddressMap.Status = Status
|
||||
AddAddressMap = AddressMapAdd(CAddressMap)
|
||||
Account = CAddressMap.Account
|
||||
SourceAddress = CAddressMap.SourceAddress
|
||||
DestinationAddress = CAddressMap.DestinationAddress
|
||||
Scope = CAddressMap.Scope
|
||||
Status = CAddressMap.Status
|
||||
End Function
|
||||
|
||||
Private Function CString(ByVal InString As String) As String
|
||||
CString = InString & Chr(0)
|
||||
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
|
||||
Public Function RemoveAddressMap(Optional ByVal DeleteAll As Boolean = False) As Integer
|
||||
Dim CAddressMap As IADDRESSMAPENTRYTYPE
|
||||
Dim lResult As Long
|
||||
|
||||
'if the one to remove is a catchall we need to rename first
|
||||
If Not DeleteAll And InStr(1, SourceAddress, "[SMTP:*@", vbTextCompare) = 1 Then
|
||||
|
||||
Dim oAddressMap As New MailEnableAddressMap
|
||||
|
||||
With oAddressMap
|
||||
.Account = Account
|
||||
.DestinationAddress = DestinationAddress
|
||||
.Scope = ""
|
||||
.SourceAddress = SourceAddress
|
||||
End With
|
||||
|
||||
lResult = oAddressMap.EditAddressMap(Account, "[SMTP:___~@deleteme]", "[SF:___~" & Account & "/toremove]", "", -1)
|
||||
|
||||
oAddressMap = Nothing
|
||||
|
||||
CAddressMap.Account = CString(Account)
|
||||
CAddressMap.SourceAddress = CString("[SMTP:___~@deleteme]")
|
||||
CAddressMap.DestinationAddress = CString("[SF:___~" & Account & "/toremove]")
|
||||
CAddressMap.Scope = CString("")
|
||||
CAddressMap.Status = Status
|
||||
RemoveAddressMap = AddressMapRemove(CAddressMap)
|
||||
Account = NonCString(CAddressMap.Account)
|
||||
SourceAddress = NonCString(CAddressMap.SourceAddress)
|
||||
DestinationAddress = NonCString(CAddressMap.DestinationAddress)
|
||||
Scope = NonCString(CAddressMap.Scope)
|
||||
Status = CAddressMap.Status
|
||||
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
CAddressMap.Account = CString(Account)
|
||||
CAddressMap.SourceAddress = CString(SourceAddress)
|
||||
CAddressMap.DestinationAddress = CString(DestinationAddress)
|
||||
CAddressMap.Scope = CString(Scope)
|
||||
CAddressMap.Status = Status
|
||||
RemoveAddressMap = AddressMapRemove(CAddressMap)
|
||||
Account = NonCString(CAddressMap.Account)
|
||||
SourceAddress = NonCString(CAddressMap.SourceAddress)
|
||||
DestinationAddress = NonCString(CAddressMap.DestinationAddress)
|
||||
Scope = NonCString(CAddressMap.Scope)
|
||||
Status = CAddressMap.Status
|
||||
End Function
|
||||
|
||||
Public Function EditAddressMap(ByVal NewAccount As String, ByVal NewSourceAddress As String, ByVal NewDestinationAddress As String, ByVal NewScope As String, ByVal NewStatus As Integer) As Integer
|
||||
Dim CAddressMap As IADDRESSMAPENTRYTYPE
|
||||
Dim CAddressMapData As IADDRESSMAPENTRYTYPE
|
||||
CAddressMap.Account = Account
|
||||
CAddressMap.SourceAddress = SourceAddress
|
||||
CAddressMap.DestinationAddress = DestinationAddress
|
||||
CAddressMap.Scope = Scope
|
||||
CAddressMap.Status = Status
|
||||
|
||||
CAddressMapData.Account = NewAccount
|
||||
CAddressMapData.SourceAddress = NewSourceAddress
|
||||
CAddressMapData.DestinationAddress = NewDestinationAddress
|
||||
CAddressMapData.Scope = NewScope
|
||||
CAddressMapData.Status = NewStatus
|
||||
EditAddressMap = AddressMapEdit(CAddressMap, CAddressMapData)
|
||||
End Function
|
||||
|
||||
Public Property Account() As String
|
||||
Get
|
||||
Return Me.AccountVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.AccountVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property SourceAddress() As String
|
||||
Get
|
||||
Return Me.SourceAddressVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.SourceAddressVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property DestinationAddress() As String
|
||||
Get
|
||||
Return Me.DestinationAddressVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.DestinationAddressVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Status() As Integer
|
||||
Get
|
||||
Return Me.StatusVal
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
Me.StatusVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Public Property Scope() As String
|
||||
Get
|
||||
Return Me.ScopeVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.ScopeVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Host() As String
|
||||
Get
|
||||
Return Me.HostVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.HostVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,199 @@
|
|||
Option Strict Off
|
||||
Option Explicit On
|
||||
|
||||
Namespace WebsitePanel.Providers.Mail
|
||||
|
||||
Public Class MailEnableDomainBlacklist
|
||||
Inherits MarshalByRefObject
|
||||
|
||||
Private TargetDomainNameVal As String
|
||||
Private BannedDomainNameVal As String
|
||||
Private StatusVal As Integer
|
||||
Private AccountVal As String
|
||||
Private HostVal As String
|
||||
|
||||
Private Structure ISMTPBLACKLISTTYPE
|
||||
<VBFixedString(512), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=512)> Public TargetDomainName As String
|
||||
<VBFixedString(512), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=512)> Public BannedDomainName As String
|
||||
Public Status As Integer
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public Account As String
|
||||
End Structure
|
||||
|
||||
Private Declare Function SMTPBlacklistAdd Lib "MEAISM.DLL" (ByRef SMTPBlacklist As ISMTPBLACKLISTTYPE) As Integer
|
||||
Private Declare Function SMTPBlacklistGet Lib "MEAISM.DLL" (ByRef SMTPBlacklistCriteria As ISMTPBLACKLISTTYPE) As Integer
|
||||
Private Declare Function SMTPBlacklistEdit Lib "MEAISM.DLL" (ByRef SMTPBlacklistCriteria As ISMTPBLACKLISTTYPE, ByRef SMTPBlacklistData As ISMTPBLACKLISTTYPE) As Integer
|
||||
Private Declare Function SMTPBlacklistRemove Lib "MEAISM.DLL" (ByRef SMTPBlacklist As ISMTPBLACKLISTTYPE) As Integer
|
||||
Private Declare Function SMTPBlacklistFindFirst Lib "MEAISM.DLL" (ByRef SMTPBlacklist As ISMTPBLACKLISTTYPE) As Integer
|
||||
Private Declare Function SMTPBlacklistFindNext Lib "MEAISM.DLL" (ByRef SMTPBlacklist As ISMTPBLACKLISTTYPE) As Integer
|
||||
Private Declare Function SetCurrentHost Lib "MEAISM.DLL" (ByVal CurrentHost As String) As Integer
|
||||
|
||||
Public Function SetHost() As Integer
|
||||
SetHost = SetCurrentHost(Host)
|
||||
End Function
|
||||
|
||||
Public Function AddBlacklist() As Integer
|
||||
|
||||
Dim CBlacklist As ISMTPBLACKLISTTYPE
|
||||
|
||||
CBlacklist.TargetDomainName = TargetDomainName
|
||||
CBlacklist.BannedDomainName = BannedDomainName
|
||||
CBlacklist.Status = Status
|
||||
CBlacklist.Account = Account
|
||||
|
||||
AddBlacklist = SMTPBlacklistAdd(CBlacklist)
|
||||
|
||||
TargetDomainName = CBlacklist.TargetDomainName
|
||||
BannedDomainName = CBlacklist.BannedDomainName
|
||||
Status = CBlacklist.Status
|
||||
Account = CBlacklist.Account
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function GetBlacklist() As Integer
|
||||
|
||||
Dim CBlacklist As ISMTPBLACKLISTTYPE
|
||||
|
||||
CBlacklist.TargetDomainName = TargetDomainName
|
||||
CBlacklist.BannedDomainName = BannedDomainName
|
||||
CBlacklist.Status = Status
|
||||
CBlacklist.Account = Account
|
||||
|
||||
GetBlacklist = SMTPBlacklistGet(CBlacklist)
|
||||
|
||||
TargetDomainName = CBlacklist.TargetDomainName
|
||||
BannedDomainName = CBlacklist.BannedDomainName
|
||||
Status = CBlacklist.Status
|
||||
Account = CBlacklist.Account
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function EditBlacklist(ByVal NewTargetDomainName As String, ByVal NewBannedDomainName As String, ByVal NewStatus As Integer, ByVal NewAccount As String) As Integer
|
||||
|
||||
Dim CBlacklist As ISMTPBLACKLISTTYPE
|
||||
Dim CBlacklistData As ISMTPBLACKLISTTYPE
|
||||
|
||||
CBlacklist.TargetDomainName = TargetDomainName
|
||||
CBlacklist.BannedDomainName = BannedDomainName
|
||||
CBlacklist.Status = Status
|
||||
CBlacklist.Account = Account
|
||||
CBlacklistData.TargetDomainName = NewTargetDomainName
|
||||
CBlacklistData.BannedDomainName = NewBannedDomainName
|
||||
CBlacklistData.Status = NewStatus
|
||||
CBlacklistData.Account = NewAccount
|
||||
|
||||
EditBlacklist = SMTPBlacklistEdit(CBlacklist, CBlacklistData)
|
||||
|
||||
TargetDomainName = CBlacklist.TargetDomainName
|
||||
BannedDomainName = CBlacklist.BannedDomainName
|
||||
Status = CBlacklist.Status
|
||||
Account = CBlacklist.Account
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function RemoveBlacklist() As Integer
|
||||
|
||||
Dim CBlacklist As ISMTPBLACKLISTTYPE
|
||||
|
||||
CBlacklist.TargetDomainName = TargetDomainName
|
||||
CBlacklist.BannedDomainName = BannedDomainName
|
||||
CBlacklist.Status = Status
|
||||
CBlacklist.Account = Account
|
||||
|
||||
RemoveBlacklist = SMTPBlacklistRemove(CBlacklist)
|
||||
|
||||
TargetDomainName = CBlacklist.TargetDomainName
|
||||
BannedDomainName = CBlacklist.BannedDomainName
|
||||
Status = CBlacklist.Status
|
||||
Account = CBlacklist.Account
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function FindFirstBlacklist() As Integer
|
||||
|
||||
Dim CBlacklist As ISMTPBLACKLISTTYPE
|
||||
|
||||
CBlacklist.TargetDomainName = TargetDomainName
|
||||
CBlacklist.BannedDomainName = BannedDomainName
|
||||
CBlacklist.Status = Status
|
||||
CBlacklist.Account = Account
|
||||
|
||||
FindFirstBlacklist = SMTPBlacklistFindFirst(CBlacklist)
|
||||
|
||||
TargetDomainName = CBlacklist.TargetDomainName
|
||||
BannedDomainName = CBlacklist.BannedDomainName
|
||||
Status = CBlacklist.Status
|
||||
Account = CBlacklist.Account
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function FindNextBlacklist() As Integer
|
||||
|
||||
Dim CBlacklist As ISMTPBLACKLISTTYPE
|
||||
|
||||
CBlacklist.TargetDomainName = TargetDomainName
|
||||
CBlacklist.BannedDomainName = BannedDomainName
|
||||
CBlacklist.Status = Status
|
||||
CBlacklist.Account = Account
|
||||
|
||||
FindNextBlacklist = SMTPBlacklistFindNext(CBlacklist)
|
||||
|
||||
TargetDomainName = CBlacklist.TargetDomainName
|
||||
BannedDomainName = CBlacklist.BannedDomainName
|
||||
Status = CBlacklist.Status
|
||||
Account = CBlacklist.Account
|
||||
|
||||
End Function
|
||||
|
||||
Public Property TargetDomainName() As String
|
||||
Get
|
||||
Return Me.TargetDomainNameVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.TargetDomainNameVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property BannedDomainName() As String
|
||||
Get
|
||||
Return Me.BannedDomainNameVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.BannedDomainNameVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Status() As Integer
|
||||
Get
|
||||
Return Me.StatusVal
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
Me.StatusVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Account() As String
|
||||
Get
|
||||
Return Me.AccountVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.AccountVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Host() As String
|
||||
Get
|
||||
Return Me.HostVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.HostVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,372 @@
|
|||
Option Strict Off
|
||||
Option Explicit On
|
||||
|
||||
Namespace WebsitePanel.Providers.Mail
|
||||
|
||||
Public Class MailEnableDomain
|
||||
Inherits MarshalByRefObject
|
||||
|
||||
Private DomainNameVal As String
|
||||
Private StatusVal As Integer
|
||||
Private DomainRedirectionStatusVal As Integer
|
||||
Private DomainRedirectionHostsVal As String
|
||||
Private AccountNameVal As String
|
||||
Private HostVal As String
|
||||
Private RetainModeVal As Integer ' this is used to hold messages waiting for pickup by issued ETRN
|
||||
Private PollForMessagesVal As Integer ' this indicates that we need to poll a host for messages for this domain
|
||||
Private UpStreamHostVal As String ' this is the address of the host to poll if we are set to poll a remote host
|
||||
Private PollIntervalVal As Integer ' this is the frequency in minutes that we need to poll the remote host
|
||||
Private AliasModeVal As Integer
|
||||
Private AliasNameVal As String
|
||||
|
||||
Private Structure ISMTPDOMAINTYPE
|
||||
<VBFixedString(512), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=512)> Public DomainName As String
|
||||
Public Status As Integer
|
||||
Public DomainRedirectionStatus As Integer
|
||||
<VBFixedString(2048), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=2048)> Public DomainRedirectionHosts As String
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public AccountName As String
|
||||
Public RetainMode As Integer ' this is used to hold messages waiting for pickup by issued ETRN
|
||||
Public PollForMessages As Integer ' this indicates that we need to poll a host for messages for this domain
|
||||
<VBFixedString(512), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=512)> Public UpStreamHost As String ' this is the address of the host to poll if we are set to poll a remote host
|
||||
Public PollInterval As Integer ' this is the frequency in minutes that we need to poll the remote host
|
||||
Public AliasMode As Integer
|
||||
<VBFixedString(512), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=512)> Public AliasName As String
|
||||
End Structure
|
||||
|
||||
Private Declare Function SMTPDomainAdd Lib "MEAISM.DLL" (ByRef SMTPDomain As ISMTPDOMAINTYPE) As Integer
|
||||
Private Declare Function SMTPDomainGet Lib "MEAISM.DLL" (ByRef SMTPDomainCriteria As ISMTPDOMAINTYPE) As Integer
|
||||
Private Declare Function SMTPDomainEdit Lib "MEAISM.DLL" (ByRef SMTPDomainCriteria As ISMTPDOMAINTYPE, ByRef SMTPDomainData As ISMTPDOMAINTYPE) As Integer
|
||||
Private Declare Function SMTPDomainRemove Lib "MEAISM.DLL" (ByRef SMTPDomain As ISMTPDOMAINTYPE) As Integer
|
||||
Private Declare Function SMTPDomainFindFirst Lib "MEAISM.DLL" (ByRef SMTPDomain As ISMTPDOMAINTYPE) As Integer
|
||||
Private Declare Function SMTPDomainFindNext Lib "MEAISM.DLL" (ByRef SMTPDomain As ISMTPDOMAINTYPE) As Integer
|
||||
Private Declare Function SetCurrentHost Lib "MEAISM.DLL" (ByVal CurrentHost As String) As Integer
|
||||
|
||||
Public Function SetHost() As Integer
|
||||
SetHost = SetCurrentHost(Host)
|
||||
End Function
|
||||
|
||||
Public Function AddDomain() As Integer
|
||||
|
||||
Dim CDomain As ISMTPDOMAINTYPE
|
||||
|
||||
CDomain.AliasMode = 0
|
||||
CDomain.AliasName = ""
|
||||
CDomain.PollForMessages = 0
|
||||
CDomain.PollInterval = 0
|
||||
CDomain.RetainMode = 0
|
||||
CDomain.UpStreamHost = ""
|
||||
|
||||
CDomain.AccountName = AccountName
|
||||
CDomain.DomainName = DomainName
|
||||
CDomain.DomainRedirectionHosts = DomainRedirectionHosts
|
||||
CDomain.DomainRedirectionStatus = DomainRedirectionStatus
|
||||
CDomain.Status = Status
|
||||
|
||||
AddDomain = SMTPDomainAdd(CDomain)
|
||||
|
||||
AccountName = CDomain.AccountName
|
||||
DomainName = CDomain.DomainName
|
||||
DomainRedirectionHosts = CDomain.DomainRedirectionHosts
|
||||
DomainRedirectionStatus = CDomain.DomainRedirectionStatus
|
||||
Status = CDomain.Status
|
||||
|
||||
'Console.WriteLine("AddDomain called on server")
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function GetDomain() As Integer
|
||||
|
||||
Dim CDomain As ISMTPDOMAINTYPE
|
||||
CDomain.AliasMode = -1
|
||||
CDomain.AliasName = ""
|
||||
CDomain.PollForMessages = -1
|
||||
CDomain.PollInterval = -1
|
||||
CDomain.RetainMode = -1
|
||||
CDomain.UpStreamHost = ""
|
||||
|
||||
CDomain.AccountName = AccountName
|
||||
CDomain.DomainName = DomainName
|
||||
CDomain.DomainRedirectionHosts = DomainRedirectionHosts
|
||||
CDomain.DomainRedirectionStatus = DomainRedirectionStatus
|
||||
CDomain.Status = Status
|
||||
|
||||
GetDomain = SMTPDomainGet(CDomain)
|
||||
|
||||
AccountName = CDomain.AccountName
|
||||
DomainName = CDomain.DomainName
|
||||
DomainRedirectionHosts = CDomain.DomainRedirectionHosts
|
||||
DomainRedirectionStatus = CDomain.DomainRedirectionStatus
|
||||
Status = CDomain.Status
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function EditDomain(ByVal NewDomainName As String, ByVal NewStatus As Integer, ByVal NewDomainRedirectionStatus As Integer, ByVal NewDomainRedirectionHosts As String, ByVal NewAccountName As String) As Integer
|
||||
|
||||
Dim CDomain As ISMTPDOMAINTYPE
|
||||
CDomain.AliasMode = -1
|
||||
CDomain.AliasName = ""
|
||||
CDomain.PollForMessages = -1
|
||||
CDomain.PollInterval = -1
|
||||
CDomain.RetainMode = -1
|
||||
CDomain.UpStreamHost = ""
|
||||
Dim CDomainData As ISMTPDOMAINTYPE
|
||||
|
||||
CDomain.AccountName = AccountName
|
||||
CDomain.DomainName = DomainName
|
||||
CDomain.DomainRedirectionHosts = DomainRedirectionHosts
|
||||
CDomain.DomainRedirectionStatus = DomainRedirectionStatus
|
||||
CDomain.Status = Status
|
||||
CDomainData.AccountName = NewAccountName
|
||||
CDomainData.DomainName = NewDomainName
|
||||
CDomainData.DomainRedirectionHosts = NewDomainRedirectionHosts
|
||||
CDomainData.DomainRedirectionStatus = NewDomainRedirectionStatus
|
||||
CDomainData.Status = NewStatus
|
||||
|
||||
CDomainData.AliasMode = 0
|
||||
CDomainData.AliasName = ""
|
||||
CDomainData.PollForMessages = 0
|
||||
CDomainData.PollInterval = 0
|
||||
CDomainData.RetainMode = 0
|
||||
CDomainData.UpStreamHost = ""
|
||||
|
||||
EditDomain = SMTPDomainEdit(CDomain, CDomainData)
|
||||
|
||||
AccountName = CDomain.AccountName
|
||||
DomainName = CDomain.DomainName
|
||||
DomainRedirectionHosts = CDomain.DomainRedirectionHosts
|
||||
DomainRedirectionStatus = CDomain.DomainRedirectionStatus
|
||||
Status = CDomain.Status
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function RemoveDomain() As Integer
|
||||
|
||||
Dim CDomain As ISMTPDOMAINTYPE
|
||||
CDomain.AliasMode = -1
|
||||
CDomain.AliasName = ""
|
||||
CDomain.PollForMessages = -1
|
||||
CDomain.PollInterval = -1
|
||||
CDomain.RetainMode = -1
|
||||
CDomain.UpStreamHost = ""
|
||||
|
||||
CDomain.AccountName = AccountName
|
||||
CDomain.DomainName = DomainName
|
||||
CDomain.DomainRedirectionHosts = DomainRedirectionHosts
|
||||
CDomain.DomainRedirectionStatus = DomainRedirectionStatus
|
||||
CDomain.Status = Status
|
||||
|
||||
RemoveDomain = SMTPDomainRemove(CDomain)
|
||||
|
||||
AccountName = CDomain.AccountName
|
||||
DomainName = CDomain.DomainName
|
||||
DomainRedirectionHosts = CDomain.DomainRedirectionHosts
|
||||
DomainRedirectionStatus = CDomain.DomainRedirectionStatus
|
||||
Status = CDomain.Status
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function FindFirstDomain() As Integer
|
||||
|
||||
Dim CDomain As ISMTPDOMAINTYPE
|
||||
CDomain.AliasMode = -1
|
||||
CDomain.AliasName = ""
|
||||
CDomain.PollForMessages = -1
|
||||
CDomain.PollInterval = -1
|
||||
CDomain.RetainMode = -1
|
||||
CDomain.UpStreamHost = ""
|
||||
|
||||
CDomain.AccountName = AccountName
|
||||
CDomain.DomainName = DomainName
|
||||
CDomain.DomainRedirectionHosts = DomainRedirectionHosts
|
||||
CDomain.DomainRedirectionStatus = DomainRedirectionStatus
|
||||
CDomain.Status = Status
|
||||
|
||||
FindFirstDomain = SMTPDomainFindFirst(CDomain)
|
||||
|
||||
AccountName = CDomain.AccountName
|
||||
DomainName = CDomain.DomainName
|
||||
DomainRedirectionHosts = CDomain.DomainRedirectionHosts
|
||||
DomainRedirectionStatus = CDomain.DomainRedirectionStatus
|
||||
Status = CDomain.Status
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function FindNextDomain() As Integer
|
||||
|
||||
Dim CDomain As ISMTPDOMAINTYPE
|
||||
|
||||
CDomain.AccountName = AccountName
|
||||
CDomain.DomainName = DomainName
|
||||
CDomain.DomainRedirectionHosts = DomainRedirectionHosts
|
||||
CDomain.DomainRedirectionStatus = DomainRedirectionStatus
|
||||
CDomain.Status = Status
|
||||
|
||||
|
||||
CDomain.AliasMode = -1
|
||||
CDomain.AliasName = ""
|
||||
CDomain.PollForMessages = -1
|
||||
CDomain.PollInterval = -1
|
||||
CDomain.RetainMode = -1
|
||||
CDomain.UpStreamHost = ""
|
||||
|
||||
FindNextDomain = SMTPDomainFindNext(CDomain)
|
||||
|
||||
AccountName = CDomain.AccountName
|
||||
DomainName = CDomain.DomainName
|
||||
DomainRedirectionHosts = CDomain.DomainRedirectionHosts
|
||||
DomainRedirectionStatus = CDomain.DomainRedirectionStatus
|
||||
Status = CDomain.Status
|
||||
|
||||
End Function
|
||||
|
||||
Public Property DomainName() As String
|
||||
Get
|
||||
Return Me.DomainNameVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.DomainNameVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Status() As Integer
|
||||
Get
|
||||
Return Me.StatusVal
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
Me.StatusVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property DomainRedirectionStatus() As Integer
|
||||
Get
|
||||
Return Me.DomainRedirectionStatusVal
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
Me.DomainRedirectionStatusVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property DomainRedirectionHosts() As String
|
||||
Get
|
||||
Return Me.DomainRedirectionHostsVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.DomainRedirectionHostsVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property AccountName() As String
|
||||
Get
|
||||
Return Me.AccountNameVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.AccountNameVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Host() As String
|
||||
Get
|
||||
Return Me.HostVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.HostVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property RetainMode() As Integer
|
||||
Get
|
||||
Return Me.RetainModeVal
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
Me.RetainModeVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property PollForMessages() As Integer
|
||||
Get
|
||||
Return Me.PollForMessagesVal
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
Me.PollForMessagesVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property UpStreamHost() As String
|
||||
Get
|
||||
Return Me.UpStreamHostVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.UpStreamHostVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property PollInterval() As Integer
|
||||
Get
|
||||
Return Me.PollIntervalVal
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
Me.PollIntervalVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property AliasMode() As Integer
|
||||
Get
|
||||
Return Me.AliasModeVal
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
Me.AliasModeVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property AliasName() As String
|
||||
Get
|
||||
Return Me.AliasNameVal
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
Me.AliasNameVal = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Function CString(ByVal InString As String) As String
|
||||
CString = InString & Chr(0)
|
||||
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
|
||||
|
||||
Public Function Exists(ByVal DomainName As String) As Boolean
|
||||
|
||||
Dim CDomain As New ISMTPDOMAINTYPE
|
||||
|
||||
CDomain.AccountName = CString("")
|
||||
CDomain.DomainName = CString(DomainName)
|
||||
CDomain.DomainRedirectionHosts = CString("")
|
||||
CDomain.DomainRedirectionStatus = -1
|
||||
CDomain.Status = -1
|
||||
|
||||
Exists = (SMTPDomainGet(CDomain) = 1)
|
||||
|
||||
End Function
|
||||
|
||||
Private Sub AddDataTableColumns(ByRef oTable As DataTable)
|
||||
oTable.Columns.Add("DomainName", GetType(String))
|
||||
oTable.Columns.Add("Status", GetType(Long))
|
||||
oTable.Columns.Add("RedirectionStatus", GetType(Long))
|
||||
oTable.Columns.Add("RedirectionHosts", GetType(String))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
End Namespace
|
|
@ -0,0 +1,191 @@
|
|||
Namespace WebsitePanel.Providers.Mail
|
||||
|
||||
Public Class MailEnableGroup
|
||||
Inherits MarshalByRefObject
|
||||
|
||||
Private RecipientAddressVal As String
|
||||
Private PostofficeVal As String
|
||||
Private GroupNameVal As String
|
||||
Private GroupFileVal As String
|
||||
Private GroupStatusVal As Integer
|
||||
Private HostVal As String
|
||||
|
||||
Private Structure IGROUPTYPE
|
||||
<VBFixedString(1024), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=1024)> Public RecipientAddress As String
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public Postoffice As String
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public GroupName As String
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public GroupFile As String
|
||||
Public GroupStatus As Integer
|
||||
End Structure
|
||||
|
||||
Private Declare Function GroupGet Lib "MEAIPO.DLL" (ByRef lpGroup As IGROUPTYPE) As Integer
|
||||
Private Declare Function GroupFindFirst Lib "MEAIPO.DLL" (ByRef lpGroup As IGROUPTYPE) As Integer
|
||||
Private Declare Function GroupFindNext Lib "MEAIPO.DLL" (ByRef lpGroup As IGROUPTYPE) As Integer
|
||||
Private Declare Function GroupAdd Lib "MEAIPO.DLL" (ByRef lpGroup As IGROUPTYPE) As Integer
|
||||
Private Declare Function GroupEdit Lib "MEAIPO.DLL" (ByRef TargetGroup As IGROUPTYPE, ByRef NewGroup As IGROUPTYPE) As Integer
|
||||
Private Declare Function GroupRemove Lib "MEAIPO.DLL" (ByRef lpGroup As IGROUPTYPE) As Integer
|
||||
Private Declare Function SetCurrentHost Lib "MEAIPO.DLL" (ByVal CurrentHost As String) As Integer
|
||||
|
||||
Public Function SetHost() As Integer
|
||||
SetHost = SetCurrentHost(Host)
|
||||
End Function
|
||||
|
||||
Public Function FindFirstGroup() As Integer
|
||||
Dim CGroup As IGROUPTYPE
|
||||
CGroup.GroupFile = GroupFile
|
||||
CGroup.Postoffice = Postoffice
|
||||
CGroup.GroupName = GroupName
|
||||
CGroup.RecipientAddress = RecipientAddress
|
||||
CGroup.GroupStatus = GroupStatus
|
||||
FindFirstGroup = GroupFindFirst(CGroup)
|
||||
GroupFile = CGroup.GroupFile
|
||||
Postoffice = CGroup.Postoffice
|
||||
GroupName = CGroup.GroupName
|
||||
RecipientAddress = CGroup.RecipientAddress
|
||||
GroupStatus = CGroup.GroupStatus
|
||||
End Function
|
||||
Public Function FindNextGroup() As Integer
|
||||
Dim CGroup As IGROUPTYPE
|
||||
CGroup.GroupFile = GroupFile
|
||||
CGroup.Postoffice = Postoffice
|
||||
CGroup.GroupName = GroupName
|
||||
CGroup.RecipientAddress = RecipientAddress
|
||||
CGroup.GroupStatus = GroupStatus
|
||||
FindNextGroup = GroupFindNext(CGroup)
|
||||
GroupFile = CGroup.GroupFile
|
||||
Postoffice = CGroup.Postoffice
|
||||
GroupName = CGroup.GroupName
|
||||
RecipientAddress = CGroup.RecipientAddress
|
||||
GroupStatus = CGroup.GroupStatus
|
||||
End Function
|
||||
|
||||
Public Function AddGroup() As Integer
|
||||
Dim CGroup As IGROUPTYPE
|
||||
CGroup.GroupFile = GroupFile
|
||||
CGroup.Postoffice = Postoffice
|
||||
CGroup.GroupName = GroupName
|
||||
CGroup.RecipientAddress = RecipientAddress
|
||||
CGroup.GroupStatus = GroupStatus
|
||||
AddGroup = GroupAdd(CGroup)
|
||||
GroupFile = CGroup.GroupFile
|
||||
Postoffice = CGroup.Postoffice
|
||||
GroupName = CGroup.GroupName
|
||||
RecipientAddress = CGroup.RecipientAddress
|
||||
GroupStatus = CGroup.GroupStatus
|
||||
End Function
|
||||
|
||||
Public Function GetGroup() As Integer
|
||||
Dim CGroup As IGROUPTYPE
|
||||
CGroup.GroupFile = GroupFile
|
||||
CGroup.Postoffice = Postoffice
|
||||
CGroup.GroupName = GroupName
|
||||
CGroup.RecipientAddress = RecipientAddress
|
||||
CGroup.GroupStatus = GroupStatus
|
||||
GetGroup = GroupGet(CGroup)
|
||||
GroupFile = CGroup.GroupFile
|
||||
Postoffice = CGroup.Postoffice
|
||||
GroupName = CGroup.GroupName
|
||||
RecipientAddress = CGroup.RecipientAddress
|
||||
GroupStatus = CGroup.GroupStatus
|
||||
End Function
|
||||
Public Function RemoveGroup() As Integer
|
||||
Dim CGroup As IGROUPTYPE
|
||||
CGroup.GroupFile = GroupFile
|
||||
CGroup.Postoffice = Postoffice
|
||||
CGroup.GroupName = GroupName
|
||||
CGroup.RecipientAddress = RecipientAddress
|
||||
CGroup.GroupStatus = GroupStatus
|
||||
RemoveGroup = GroupRemove(CGroup)
|
||||
GroupFile = CGroup.GroupFile
|
||||
Postoffice = CGroup.Postoffice
|
||||
GroupName = CGroup.GroupName
|
||||
RecipientAddress = CGroup.RecipientAddress
|
||||
GroupStatus = CGroup.GroupStatus
|
||||
End Function
|
||||
|
||||
Public Function EditGroup(ByVal NewRecipientAddress As String, ByVal NewPostoffice As String, ByVal NewGroupName As String, ByVal NewGroupFile As String, ByVal NewGroupStatus As Integer) As Integer
|
||||
Dim CGroup As IGROUPTYPE
|
||||
Dim CGroupData As IGROUPTYPE
|
||||
' Get the Find Stuff Set up
|
||||
CGroup.GroupFile = GroupFile
|
||||
CGroup.GroupName = GroupName
|
||||
CGroup.Postoffice = Postoffice
|
||||
CGroup.RecipientAddress = RecipientAddress
|
||||
CGroup.GroupStatus = GroupStatus
|
||||
' Get the Data Set up
|
||||
CGroupData.GroupFile = NewGroupFile
|
||||
CGroupData.GroupName = NewGroupName
|
||||
CGroupData.Postoffice = NewPostoffice
|
||||
CGroupData.RecipientAddress = NewRecipientAddress
|
||||
CGroupData.GroupStatus = NewGroupStatus
|
||||
|
||||
EditGroup = GroupEdit(CGroup, CGroupData)
|
||||
GroupFile = CGroupData.GroupFile
|
||||
Postoffice = CGroupData.Postoffice
|
||||
GroupName = CGroupData.GroupName
|
||||
RecipientAddress = CGroupData.RecipientAddress
|
||||
GroupStatus = CGroup.GroupStatus
|
||||
End Function
|
||||
|
||||
Private Sub AddDataTableColumns(ByRef oTable As DataTable)
|
||||
oTable.Columns.Add("GroupName", GetType(String))
|
||||
oTable.Columns.Add("GroupStatus", GetType(Long))
|
||||
oTable.Columns.Add("RecipientAddress", GetType(String))
|
||||
End Sub
|
||||
|
||||
Public Property RecipientAddress() As String
|
||||
Get
|
||||
Return Me.RecipientAddressVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.RecipientAddressVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Postoffice() As String
|
||||
Get
|
||||
Return Me.PostofficeVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.PostofficeVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property GroupName() As String
|
||||
Get
|
||||
Return Me.GroupNameVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.GroupNameVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property GroupFile() As String
|
||||
Get
|
||||
Return Me.GroupFileVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.GroupFileVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property GroupStatus() As Integer
|
||||
Get
|
||||
Return Me.GroupStatusVal
|
||||
End Get
|
||||
Set(ByVal value As Integer)
|
||||
Me.GroupStatusVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Host() As String
|
||||
Get
|
||||
Return Me.HostVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.HostVal = value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,141 @@
|
|||
Namespace WebsitePanel.Providers.Mail
|
||||
|
||||
Public Class MailEnableGroupMember
|
||||
Inherits MarshalByRefObject
|
||||
|
||||
Private AddressVal As String
|
||||
Private PostofficeVal As String
|
||||
Private MailboxVal As String
|
||||
Private HostVal As String
|
||||
|
||||
Private Structure IGROUPMEMBERTYPE
|
||||
<VBFixedString(256), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=256)> Public Address As String
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public Postoffice As String
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public Mailbox As String
|
||||
End Structure
|
||||
|
||||
Private Declare Function GroupMemberGet Lib "MEAIPO.DLL" (ByRef lpGroupMember As IGROUPMEMBERTYPE) As Integer
|
||||
Private Declare Function GroupMemberFindFirst Lib "MEAIPO.DLL" (ByRef lpGroupMember As IGROUPMEMBERTYPE) As Integer
|
||||
Private Declare Function GroupMemberFindNext Lib "MEAIPO.DLL" (ByRef lpGroupMember As IGROUPMEMBERTYPE) As Integer
|
||||
Private Declare Function GroupMemberAdd Lib "MEAIPO.DLL" (ByRef lpGroupMember As IGROUPMEMBERTYPE) As Integer
|
||||
Private Declare Function GroupMemberEdit Lib "MEAIPO.DLL" (ByRef TargetGroupMember As IGROUPMEMBERTYPE, ByRef NewGroupMember As IGROUPMEMBERTYPE) As Integer
|
||||
Private Declare Function GroupMemberRemove Lib "MEAIPO.DLL" (ByRef lpGroupMember As IGROUPMEMBERTYPE) As Integer
|
||||
Private Declare Function SetCurrentHost Lib "MEAIPO.DLL" (ByVal CurrentHost As String) As Integer
|
||||
|
||||
Public Function SetHost() As Integer
|
||||
SetHost = SetCurrentHost(Host)
|
||||
End Function
|
||||
|
||||
|
||||
Public Function FindFirstGroupMember() As Integer
|
||||
Dim CGroupMember As IGROUPMEMBERTYPE
|
||||
|
||||
CGroupMember.Address = Address
|
||||
CGroupMember.Postoffice = Postoffice
|
||||
CGroupMember.Mailbox = Mailbox
|
||||
FindFirstGroupMember = GroupMemberFindFirst(CGroupMember)
|
||||
Address = CGroupMember.Address
|
||||
Postoffice = CGroupMember.Postoffice
|
||||
Mailbox = CGroupMember.Mailbox
|
||||
|
||||
End Function
|
||||
|
||||
Public Function FindNextGroupMember() As Integer
|
||||
Dim CGroupMember As IGROUPMEMBERTYPE
|
||||
CGroupMember.Address = Address
|
||||
CGroupMember.Postoffice = Postoffice
|
||||
CGroupMember.Mailbox = Mailbox
|
||||
FindNextGroupMember = GroupMemberFindNext(CGroupMember)
|
||||
Address = CGroupMember.Address
|
||||
Postoffice = CGroupMember.Postoffice
|
||||
Mailbox = CGroupMember.Mailbox
|
||||
End Function
|
||||
|
||||
Public Function AddGroupMember() As Integer
|
||||
Dim CGroupMember As IGROUPMEMBERTYPE
|
||||
CGroupMember.Address = Address
|
||||
CGroupMember.Postoffice = Postoffice
|
||||
CGroupMember.Mailbox = Mailbox
|
||||
AddGroupMember = GroupMemberAdd(CGroupMember)
|
||||
Address = CGroupMember.Address
|
||||
Postoffice = CGroupMember.Postoffice
|
||||
Mailbox = CGroupMember.Mailbox
|
||||
End Function
|
||||
|
||||
Public Function GetGroupMember() As Integer
|
||||
Dim CGroupMember As IGROUPMEMBERTYPE
|
||||
CGroupMember.Address = Address
|
||||
CGroupMember.Postoffice = Postoffice
|
||||
CGroupMember.Mailbox = Mailbox
|
||||
GetGroupMember = GroupMemberGet(CGroupMember)
|
||||
Address = CGroupMember.Address
|
||||
Postoffice = CGroupMember.Postoffice
|
||||
Mailbox = CGroupMember.Mailbox
|
||||
End Function
|
||||
Public Function RemoveGroupMember() As Integer
|
||||
Dim CGroupMember As IGROUPMEMBERTYPE
|
||||
CGroupMember.Address = Address
|
||||
CGroupMember.Postoffice = Postoffice
|
||||
CGroupMember.Mailbox = Mailbox
|
||||
RemoveGroupMember = GroupMemberRemove(CGroupMember)
|
||||
Address = CGroupMember.Address
|
||||
Postoffice = CGroupMember.Postoffice
|
||||
Mailbox = CGroupMember.Mailbox
|
||||
End Function
|
||||
Public Function EditGroupMember(ByVal NewAddress As String, ByVal NewPostoffice As String, ByVal NewMailbox As String) As Integer
|
||||
|
||||
Dim CGroupMember As IGROUPMEMBERTYPE
|
||||
Dim CGroupMemberData As IGROUPMEMBERTYPE
|
||||
' Get the Find Stuff Set up
|
||||
CGroupMember.Address = Address
|
||||
CGroupMember.Postoffice = Postoffice
|
||||
CGroupMember.Mailbox = Mailbox
|
||||
' Get the Data Set up
|
||||
CGroupMemberData.Address = NewAddress
|
||||
CGroupMemberData.Postoffice = NewPostoffice
|
||||
CGroupMemberData.Mailbox = NewMailbox
|
||||
EditGroupMember = GroupMemberEdit(CGroupMember, CGroupMemberData)
|
||||
|
||||
CGroupMemberData.Address = CGroupMemberData.Address
|
||||
CGroupMemberData.Postoffice = CGroupMemberData.Postoffice
|
||||
CGroupMemberData.Mailbox = CGroupMemberData.Mailbox
|
||||
End Function
|
||||
|
||||
Public Property Address() As String
|
||||
Get
|
||||
Return Me.AddressVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.AddressVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Postoffice() As String
|
||||
Get
|
||||
Return Me.PostofficeVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.PostofficeVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Mailbox() As String
|
||||
Get
|
||||
Return Me.MailboxVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.MailboxVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Host() As String
|
||||
Get
|
||||
Return Me.HostVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.HostVal = value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
|
||||
End Namespace
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,164 @@
|
|||
Namespace WebsitePanel.Providers.Mail
|
||||
|
||||
Public Class MailEnableListMember
|
||||
Inherits MarshalByRefObject
|
||||
|
||||
Private AddressVal As String
|
||||
Private AccountNameVal As String
|
||||
Private ListNameVal As String
|
||||
Private ListMemberTypeVal As Long
|
||||
Private StatusVal As Long
|
||||
Private HostVal As String
|
||||
|
||||
|
||||
Private Structure ILISTMEMBERTYPE
|
||||
<VBFixedString(256), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=256)> Public Address As String
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public AccountName As String
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public ListName As String
|
||||
Public Role As Integer
|
||||
Public Status As Integer
|
||||
End Structure
|
||||
|
||||
|
||||
Private Declare Function ListMemberGet Lib "MEAILS.DLL" (ByRef lpListMember As ILISTMEMBERTYPE) As Integer
|
||||
Private Declare Function ListMemberFindFirst Lib "MEAILS.DLL" (ByRef lpListMember As ILISTMEMBERTYPE) As Integer
|
||||
Private Declare Function ListMemberFindNext Lib "MEAILS.DLL" (ByRef lpListMember As ILISTMEMBERTYPE) As Integer
|
||||
Private Declare Function ListMemberAdd Lib "MEAILS.DLL" (ByRef lpListMember As ILISTMEMBERTYPE) As Integer
|
||||
Private Declare Function ListMemberEdit Lib "MEAILS.DLL" (ByRef TargetListMember As ILISTMEMBERTYPE, ByRef NewListMember As ILISTMEMBERTYPE) As Integer
|
||||
Private Declare Function ListMemberRemove Lib "MEAILS.DLL" (ByRef lpListMember As ILISTMEMBERTYPE) As Integer
|
||||
Private Declare Function SetCurrentHost Lib "MEAILS.DLL" (ByVal CurrentHost As String) As Integer
|
||||
|
||||
Public Function SetHost() As Integer
|
||||
SetHost = SetCurrentHost(Host)
|
||||
End Function
|
||||
|
||||
|
||||
Public Function FindFirstListMember() As Integer
|
||||
Dim CListMember As ILISTMEMBERTYPE
|
||||
CListMember.Address = Address
|
||||
CListMember.AccountName = AccountName
|
||||
CListMember.ListName = ListName
|
||||
FindFirstListMember = ListMemberFindFirst(CListMember)
|
||||
Address = CListMember.Address
|
||||
AccountName = CListMember.AccountName
|
||||
ListName = CListMember.ListName
|
||||
End Function
|
||||
|
||||
Public Function FindNextListMember() As Integer
|
||||
Dim CListMember As ILISTMEMBERTYPE
|
||||
CListMember.Address = Address
|
||||
CListMember.AccountName = AccountName
|
||||
CListMember.ListName = ListName
|
||||
FindNextListMember = ListMemberFindNext(CListMember)
|
||||
Address = CListMember.Address
|
||||
AccountName = CListMember.AccountName
|
||||
ListName = CListMember.ListName
|
||||
End Function
|
||||
|
||||
Public Function AddListMember() As Integer
|
||||
Dim CListMember As ILISTMEMBERTYPE
|
||||
CListMember.Address = Address
|
||||
CListMember.AccountName = AccountName
|
||||
CListMember.ListName = ListName
|
||||
AddListMember = ListMemberAdd(CListMember)
|
||||
Address = CListMember.Address
|
||||
AccountName = CListMember.AccountName
|
||||
ListName = CListMember.ListName
|
||||
End Function
|
||||
|
||||
Public Function GetListMember() As Integer
|
||||
Dim CListMember As ILISTMEMBERTYPE
|
||||
CListMember.Address = Address
|
||||
CListMember.AccountName = AccountName
|
||||
CListMember.ListName = ListName
|
||||
GetListMember = ListMemberGet(CListMember)
|
||||
Address = CListMember.Address
|
||||
AccountName = CListMember.AccountName
|
||||
ListName = CListMember.ListName
|
||||
End Function
|
||||
Public Function RemoveListMember() As Integer
|
||||
Dim CListMember As ILISTMEMBERTYPE
|
||||
CListMember.Address = Address
|
||||
CListMember.AccountName = AccountName
|
||||
CListMember.ListName = ListName
|
||||
RemoveListMember = ListMemberRemove(CListMember)
|
||||
Address = CListMember.Address
|
||||
AccountName = CListMember.AccountName
|
||||
ListName = CListMember.ListName
|
||||
End Function
|
||||
|
||||
Public Function EditListMember(ByVal NewAddress, ByVal NewAccountName, ByVal NewListName, ByVal NewListMemberType, ByVal NewStatus) As Integer
|
||||
Dim CListMember As ILISTMEMBERTYPE
|
||||
Dim CListMemberData As ILISTMEMBERTYPE
|
||||
' Get the Find Stuff Set up
|
||||
CListMember.Address = Address
|
||||
CListMember.AccountName = AccountName
|
||||
CListMember.ListName = ListName
|
||||
' Get the Data Set up
|
||||
CListMemberData.Address = NewAddress
|
||||
CListMemberData.AccountName = NewAccountName
|
||||
CListMemberData.ListName = NewListName
|
||||
EditListMember = ListMemberEdit(CListMember, CListMemberData)
|
||||
|
||||
NewAddress = CListMemberData.Address
|
||||
NewAccountName = CListMemberData.AccountName
|
||||
NewListName = CListMemberData.ListName
|
||||
End Function
|
||||
|
||||
Public Property Address() As String
|
||||
Get
|
||||
Return Me.AddressVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.AddressVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property AccountName() As String
|
||||
Get
|
||||
Return Me.AccountNameVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.AccountNameVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property ListName() As String
|
||||
Get
|
||||
Return Me.ListNameVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.ListNameVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property ListMemberType() As Long
|
||||
Get
|
||||
Return Me.ListMemberTypeVal
|
||||
End Get
|
||||
Set(ByVal value As Long)
|
||||
Me.ListMemberTypeVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Status() As Long
|
||||
Get
|
||||
Return Me.StatusVal
|
||||
End Get
|
||||
Set(ByVal value As Long)
|
||||
Me.StatusVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Host() As String
|
||||
Get
|
||||
Return Me.HostVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.HostVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,264 @@
|
|||
Namespace WebsitePanel.Providers.Mail
|
||||
|
||||
Public Class MailEnableLogin
|
||||
Inherits MarshalByRefObject
|
||||
|
||||
Private UserNameVal As String
|
||||
Private StatusVal As Long
|
||||
Private PasswordVal As String
|
||||
Private AccountVal As String
|
||||
Private DescriptionVal As String
|
||||
Private LoginAttemptsVal As Long
|
||||
Private LastAttemptVal As Long
|
||||
Private LastSuccessfulLoginVal As Long
|
||||
Private RightsVal As String
|
||||
Private HostVal As String
|
||||
|
||||
Private Structure IAUTHENTRYTYPE
|
||||
<VBFixedString(64), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=64)> Public UserName As String
|
||||
Public Status As Integer
|
||||
<VBFixedString(64), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=64)> Public Password As String
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public Account As String
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public Rights As String
|
||||
<VBFixedString(1024), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=1024)> Public Description As String
|
||||
Public LoginAttempts As Integer
|
||||
Public LastAttempt As Integer
|
||||
Public LastSuccessfulLogin As Integer
|
||||
End Structure
|
||||
|
||||
Private Declare Function GetLastProviderErrorCode Lib "MEAIAU.DLL" Alias "GetLastErrorCode" () As Integer
|
||||
Private Declare Function LoginGet Lib "MEAIAU.DLL" (ByRef lpLogin As IAUTHENTRYTYPE) As Integer
|
||||
Private Declare Function LoginFindFirst Lib "MEAIAU.DLL" (ByRef lpLogin As IAUTHENTRYTYPE) As Integer
|
||||
Private Declare Function LoginFindNext Lib "MEAIAU.DLL" (ByRef lpLogin As IAUTHENTRYTYPE) As Integer
|
||||
Private Declare Function LoginAdd Lib "MEAIAU.DLL" (ByRef lpLogin As IAUTHENTRYTYPE) As Integer
|
||||
Private Declare Function LoginEdit Lib "MEAIAU.DLL" (ByRef TargetLogin As IAUTHENTRYTYPE, ByRef NewLogin As IAUTHENTRYTYPE) As Integer
|
||||
Private Declare Function LoginRemove Lib "MEAIAU.DLL" (ByRef lpLogin As IAUTHENTRYTYPE) As Integer
|
||||
Private Declare Function SetCurrentHost Lib "MEAIAU.DLL" (ByVal CurrentHost As String) As Integer
|
||||
|
||||
Public Function GetLastErrorCode() As Integer
|
||||
Return GetLastProviderErrorCode()
|
||||
End Function
|
||||
|
||||
Public Function SetHost() As Integer
|
||||
SetHost = SetCurrentHost(Host)
|
||||
End Function
|
||||
|
||||
Public Function GetLogin() As Integer
|
||||
Dim CLogin As IAUTHENTRYTYPE
|
||||
CLogin.UserName = UserName
|
||||
CLogin.Password = Password
|
||||
CLogin.Status = Status
|
||||
CLogin.Account = Account
|
||||
CLogin.Description = Description
|
||||
CLogin.Rights = Rights
|
||||
GetLogin = LoginGet(CLogin)
|
||||
UserName = CLogin.UserName
|
||||
Password = CLogin.Password
|
||||
Status = CLogin.Status
|
||||
Account = CLogin.Account
|
||||
Description = CLogin.Description
|
||||
Rights = CLogin.Rights
|
||||
End Function
|
||||
|
||||
Public Function FindFirstLogin() As Integer
|
||||
|
||||
Dim CLogin As IAUTHENTRYTYPE
|
||||
|
||||
CLogin.UserName = UserName
|
||||
CLogin.Password = Password
|
||||
CLogin.Status = Status
|
||||
CLogin.Account = Account
|
||||
CLogin.Description = Description
|
||||
CLogin.Rights = Rights
|
||||
FindFirstLogin = LoginFindFirst(CLogin)
|
||||
UserName = CLogin.UserName
|
||||
Password = CLogin.Password
|
||||
Status = CLogin.Status
|
||||
Account = CLogin.Account
|
||||
Description = CLogin.Description
|
||||
Rights = CLogin.Rights
|
||||
End Function
|
||||
|
||||
Public Function FindNextLogin() As Integer
|
||||
Dim CLogin As IAUTHENTRYTYPE
|
||||
CLogin.UserName = UserName
|
||||
CLogin.Password = Password
|
||||
CLogin.Status = Status
|
||||
CLogin.Account = Account
|
||||
CLogin.Description = Description
|
||||
CLogin.Rights = Rights
|
||||
FindNextLogin = LoginFindNext(CLogin)
|
||||
UserName = CLogin.UserName
|
||||
Password = CLogin.Password
|
||||
Status = CLogin.Status
|
||||
Account = CLogin.Account
|
||||
Description = CLogin.Description
|
||||
Rights = CLogin.Rights
|
||||
End Function
|
||||
|
||||
Public Function AddLogin() As Integer
|
||||
Dim CLogin As IAUTHENTRYTYPE
|
||||
CLogin.UserName = UserName
|
||||
CLogin.Password = Password
|
||||
CLogin.Status = Status
|
||||
CLogin.Account = Account
|
||||
CLogin.Description = Description
|
||||
CLogin.Rights = Rights
|
||||
AddLogin = LoginAdd(CLogin)
|
||||
UserName = CLogin.UserName
|
||||
Password = CLogin.Password
|
||||
Status = CLogin.Status
|
||||
Account = CLogin.Account
|
||||
Description = CLogin.Description
|
||||
Rights = CLogin.Rights
|
||||
End Function
|
||||
|
||||
Public Function RemoveLogin() As Integer
|
||||
Dim CLogin As IAUTHENTRYTYPE
|
||||
CLogin.UserName = UserName
|
||||
CLogin.Password = Password
|
||||
CLogin.Status = Status
|
||||
CLogin.Account = Account
|
||||
CLogin.Description = Description
|
||||
CLogin.Rights = Rights
|
||||
RemoveLogin = LoginRemove(CLogin)
|
||||
End Function
|
||||
|
||||
Public Function EditLogin(ByVal NewUserName As String, ByVal NewStatus As Long, ByVal NewPassword As String, ByVal NewAccount As String, ByVal NewDescription As String, ByVal NewLoginAttempts As Long, ByVal NewLastAttempt As Long, ByVal NewLastSuccessfulLogin As Long, ByVal NewRights As String) As Integer
|
||||
Dim CLogin As IAUTHENTRYTYPE
|
||||
Dim CLoginData As IAUTHENTRYTYPE
|
||||
CLogin.UserName = UserName
|
||||
CLogin.Password = Password
|
||||
CLogin.Status = Status
|
||||
CLogin.Account = Account
|
||||
CLogin.Description = Description
|
||||
CLogin.Rights = Rights
|
||||
'
|
||||
CLoginData.UserName = NewUserName
|
||||
CLoginData.Password = NewPassword
|
||||
CLoginData.Status = NewStatus
|
||||
CLoginData.Account = NewAccount
|
||||
CLoginData.Description = NewDescription
|
||||
CLoginData.Rights = NewRights
|
||||
EditLogin = LoginEdit(CLogin, CLoginData)
|
||||
End Function
|
||||
|
||||
Private Function CString(ByVal InString As String) As String
|
||||
CString = InString & Chr(0)
|
||||
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
|
||||
|
||||
Public Function Exists(ByVal sUsername As String) As Boolean
|
||||
Dim CLogin As IAUTHENTRYTYPE
|
||||
CLogin.UserName = CString(sUsername)
|
||||
CLogin.Password = CString("")
|
||||
CLogin.Status = -1
|
||||
CLogin.Account = CString("")
|
||||
CLogin.Description = CString("")
|
||||
CLogin.Rights = CString("")
|
||||
Exists = (LoginGet(CLogin) = 1)
|
||||
End Function
|
||||
|
||||
|
||||
Public Property UserName() As String
|
||||
Get
|
||||
Return Me.UserNameVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.UserNameVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Status() As Long
|
||||
Get
|
||||
Return Me.StatusVal
|
||||
End Get
|
||||
Set(ByVal value As Long)
|
||||
Me.StatusVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Password() As String
|
||||
Get
|
||||
Return Me.PasswordVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.PasswordVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Account() As String
|
||||
Get
|
||||
Return Me.AccountVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.AccountVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Description() As String
|
||||
Get
|
||||
Return Me.DescriptionVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.DescriptionVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property LoginAttempts() As Long
|
||||
Get
|
||||
Return Me.LoginAttemptsVal
|
||||
End Get
|
||||
Set(ByVal value As Long)
|
||||
Me.LoginAttemptsVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property LastAttempt() As Long
|
||||
Get
|
||||
Return Me.LastAttemptVal
|
||||
End Get
|
||||
Set(ByVal value As Long)
|
||||
Me.LastAttemptVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property LastSuccessfulLogin() As Long
|
||||
Get
|
||||
Return Me.LastSuccessfulLoginVal
|
||||
End Get
|
||||
Set(ByVal value As Long)
|
||||
Me.LastSuccessfulLoginVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Rights() As String
|
||||
Get
|
||||
Return Me.RightsVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.RightsVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Host() As String
|
||||
Get
|
||||
Return Me.HostVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.HostVal = value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,448 @@
|
|||
Imports System.IO
|
||||
Imports Microsoft.Win32
|
||||
|
||||
Namespace WebsitePanel.Providers.Mail
|
||||
|
||||
Public Class MailEnableMailbox
|
||||
Inherits MarshalByRefObject
|
||||
|
||||
Private PostofficeVal As String
|
||||
Private MailboxNameVal As String
|
||||
Private RedirectAddressVal As String
|
||||
Private RedirectStatusVal As Long
|
||||
Private StatusVal As Long
|
||||
Private LimitVal As Long
|
||||
Private SizeVal As Long
|
||||
Private HostVal As String
|
||||
|
||||
|
||||
Private Structure IMAILBOXTYPE
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public Postoffice As String
|
||||
<VBFixedString(64), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=64)> Public Mailbox As String
|
||||
<VBFixedString(512), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=512)> Public RedirectAddress As String
|
||||
Public RedirectStatus As Integer
|
||||
Public Status As Integer
|
||||
Public Limit As Integer
|
||||
Public Size As Integer
|
||||
End Structure
|
||||
|
||||
|
||||
Private Declare Function MailboxGet Lib "MEAIPO.DLL" (ByRef lpMailbox As IMAILBOXTYPE) As Integer
|
||||
Private Declare Function MailboxGetLength Lib "MEAIPO.DLL" (ByRef lpMailbox As IMAILBOXTYPE) As Integer
|
||||
Private Declare Function MailboxFindFirst Lib "MEAIPO.DLL" (ByRef lpMailbox As IMAILBOXTYPE) As Integer
|
||||
Private Declare Function MailboxFindNext Lib "MEAIPO.DLL" (ByRef lpMailbox As IMAILBOXTYPE) As Integer
|
||||
Private Declare Function MailboxAdd Lib "MEAIPO.DLL" (ByRef lpMailbox As IMAILBOXTYPE) As Integer
|
||||
Private Declare Function MailboxEdit Lib "MEAIPO.DLL" (ByRef TargetMailbox As IMAILBOXTYPE, ByRef NewMailbox As IMAILBOXTYPE) As Integer
|
||||
Private Declare Function MailboxRemove Lib "MEAIPO.DLL" (ByRef lpMailbox As IMAILBOXTYPE) As Integer
|
||||
|
||||
Private Declare Function SetCurrentHost Lib "MEAIPO.DLL" (ByVal CurrentHost As String) As Integer
|
||||
|
||||
Private Structure IANNOTATIONTYPE
|
||||
<VBFixedString(256), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=256)> Public AnnotationName As String
|
||||
<VBFixedString(256), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=256)> Public AccountName As String
|
||||
<VBFixedString(8192), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=8192)> Public AnnotationText As String
|
||||
End Structure
|
||||
|
||||
Private Declare Function AnnotationGet Lib "MEAILS.DLL" (ByRef lpAnnotation As IANNOTATIONTYPE) As Integer
|
||||
Private Declare Function AnnotationAdd Lib "MEAILS.DLL" (ByRef lpAnnotation As IANNOTATIONTYPE) As Integer
|
||||
Private Declare Function AnnotationRemove Lib "MEAILS.DLL" (ByRef lpAnnotation As IANNOTATIONTYPE) As Integer
|
||||
|
||||
|
||||
Public Function SetHost() As Integer
|
||||
SetHost = SetCurrentHost(Host)
|
||||
End Function
|
||||
|
||||
Public Function FindFirstMailbox() As Integer
|
||||
Dim CMailBox As IMAILBOXTYPE
|
||||
CMailBox.Mailbox = MailboxName
|
||||
CMailBox.Postoffice = Postoffice
|
||||
CMailBox.RedirectAddress = RedirectAddress
|
||||
CMailBox.RedirectStatus = RedirectStatus
|
||||
CMailBox.Status = Status
|
||||
CMailBox.Limit = Limit
|
||||
CMailBox.Size = Size
|
||||
FindFirstMailbox = MailboxFindFirst(CMailBox)
|
||||
MailboxName = CMailBox.Mailbox
|
||||
Postoffice = CMailBox.Postoffice
|
||||
RedirectAddress = CMailBox.RedirectAddress
|
||||
RedirectStatus = CMailBox.RedirectStatus
|
||||
Status = CMailBox.Status
|
||||
Limit = CMailBox.Limit
|
||||
Size = CMailBox.Size
|
||||
End Function
|
||||
|
||||
|
||||
Public Function FindNextMailbox() As Integer
|
||||
Dim CMailBox As IMAILBOXTYPE
|
||||
CMailBox.Mailbox = MailboxName
|
||||
CMailBox.Postoffice = Postoffice
|
||||
CMailBox.RedirectAddress = RedirectAddress
|
||||
CMailBox.RedirectStatus = RedirectStatus
|
||||
CMailBox.Status = Status
|
||||
CMailBox.Limit = Limit
|
||||
CMailBox.Size = Size
|
||||
FindNextMailbox = MailboxFindNext(CMailBox)
|
||||
MailboxName = CMailBox.Mailbox
|
||||
Postoffice = CMailBox.Postoffice
|
||||
RedirectAddress = CMailBox.RedirectAddress
|
||||
RedirectStatus = CMailBox.RedirectStatus
|
||||
Status = CMailBox.Status
|
||||
Limit = CMailBox.Limit
|
||||
Size = CMailBox.Size
|
||||
End Function
|
||||
|
||||
Public Function AddMailbox() As Integer
|
||||
Dim CMailBox As IMAILBOXTYPE
|
||||
CMailBox.Mailbox = MailboxName
|
||||
CMailBox.Postoffice = Postoffice
|
||||
CMailBox.RedirectAddress = RedirectAddress
|
||||
CMailBox.RedirectStatus = RedirectStatus
|
||||
CMailBox.Status = Status
|
||||
CMailBox.Limit = Limit
|
||||
CMailBox.Size = Size
|
||||
AddMailbox = MailboxAdd(CMailBox)
|
||||
MailboxName = CMailBox.Mailbox
|
||||
Postoffice = CMailBox.Postoffice
|
||||
RedirectAddress = CMailBox.RedirectAddress
|
||||
RedirectStatus = CMailBox.RedirectStatus
|
||||
Status = CMailBox.Status
|
||||
Limit = CMailBox.Limit
|
||||
Size = CMailBox.Size
|
||||
End Function
|
||||
|
||||
Public Function GetMailbox() As Integer
|
||||
Dim CMailBox As IMAILBOXTYPE
|
||||
CMailBox.Mailbox = MailboxName
|
||||
CMailBox.Postoffice = Postoffice
|
||||
CMailBox.RedirectAddress = RedirectAddress
|
||||
CMailBox.RedirectStatus = RedirectStatus
|
||||
CMailBox.Status = Status
|
||||
CMailBox.Limit = Limit
|
||||
CMailBox.Size = Size
|
||||
GetMailbox = MailboxGet(CMailBox)
|
||||
MailboxName = CMailBox.Mailbox
|
||||
Postoffice = CMailBox.Postoffice
|
||||
RedirectAddress = CMailBox.RedirectAddress
|
||||
RedirectStatus = CMailBox.RedirectStatus
|
||||
Status = CMailBox.Status
|
||||
Limit = CMailBox.Limit
|
||||
Size = CMailBox.Size
|
||||
End Function
|
||||
|
||||
|
||||
Public Function RemoveMailbox() As Integer
|
||||
Dim CMailBox As IMAILBOXTYPE
|
||||
CMailBox.Mailbox = MailboxName
|
||||
CMailBox.Postoffice = Postoffice
|
||||
CMailBox.RedirectAddress = RedirectAddress
|
||||
CMailBox.RedirectStatus = RedirectStatus
|
||||
CMailBox.Status = Status
|
||||
CMailBox.Limit = Limit
|
||||
CMailBox.Size = Size
|
||||
RemoveMailbox = MailboxRemove(CMailBox)
|
||||
MailboxName = CMailBox.Mailbox
|
||||
Postoffice = CMailBox.Postoffice
|
||||
RedirectAddress = CMailBox.RedirectAddress
|
||||
RedirectStatus = CMailBox.RedirectStatus
|
||||
Status = CMailBox.Status
|
||||
Limit = CMailBox.Limit
|
||||
Size = CMailBox.Size
|
||||
End Function
|
||||
|
||||
|
||||
Public Function EditMailbox(ByVal NewPostoffice As String, ByVal NewMailbox As String, ByVal NewRedirectAddress As String, ByVal NewRedirectStatus As Long, ByVal NewStatus As Long, ByVal NewLimit As Long, ByVal NewSize As Long) As Integer
|
||||
Dim CMailBox As IMAILBOXTYPE
|
||||
Dim CMailBoxData As IMAILBOXTYPE
|
||||
' Get the Find Stuff Set up
|
||||
CMailBox.Mailbox = MailboxName
|
||||
CMailBox.Postoffice = Postoffice
|
||||
CMailBox.RedirectAddress = RedirectAddress
|
||||
CMailBox.RedirectStatus = RedirectStatus
|
||||
CMailBox.Status = Status
|
||||
CMailBox.Limit = Limit
|
||||
CMailBox.Size = Size
|
||||
' Get the Data Set up
|
||||
CMailBoxData.Mailbox = NewMailbox
|
||||
CMailBoxData.Postoffice = NewPostoffice
|
||||
CMailBoxData.RedirectAddress = NewRedirectAddress
|
||||
CMailBoxData.RedirectStatus = NewRedirectStatus
|
||||
CMailBoxData.Status = NewStatus
|
||||
CMailBoxData.Limit = NewLimit
|
||||
CMailBoxData.Size = NewSize
|
||||
EditMailbox = MailboxEdit(CMailBox, CMailBoxData)
|
||||
MailboxName = CMailBox.Mailbox
|
||||
Postoffice = CMailBox.Postoffice
|
||||
RedirectAddress = CMailBox.RedirectAddress
|
||||
RedirectStatus = CMailBox.RedirectStatus
|
||||
|
||||
End Function
|
||||
|
||||
Public Function GetLength() As Integer
|
||||
Dim CMailBox As IMAILBOXTYPE
|
||||
CMailBox.Mailbox = MailboxName
|
||||
CMailBox.Postoffice = Postoffice
|
||||
CMailBox.RedirectAddress = RedirectAddress
|
||||
CMailBox.RedirectStatus = RedirectStatus
|
||||
CMailBox.Status = Status
|
||||
CMailBox.Limit = Limit
|
||||
CMailBox.Size = Size
|
||||
Return MailboxGetLength(CMailBox)
|
||||
End Function
|
||||
|
||||
|
||||
Public Function SetAutoResponderStatus(ByVal bEnabled As Boolean) As Integer
|
||||
Return SetAutoResponderStatus(Me.Postoffice, Me.MailboxName, bEnabled)
|
||||
End Function
|
||||
|
||||
Public Shared Function SetAutoResponderStatus(ByVal sPostoffice As String, ByVal sMailbox As String, ByVal bEnabled As Boolean) As Integer
|
||||
'
|
||||
' This function copies the Auto Responder Config File to indicate Enabled.
|
||||
' It deletes the CFG file to Disable
|
||||
'
|
||||
Dim SourcePath As String
|
||||
Dim TargetPath As String
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
If (bEnabled) Then
|
||||
'
|
||||
' Copy AUTORESPOND.CF_ to AUTORESPOND.CFG
|
||||
'
|
||||
SourcePath = MailEnable.GetPostofficesPath() & "\" & sPostoffice & "\MAILROOT\" & sMailbox & "\AUTORESPOND.CF_"
|
||||
TargetPath = MailEnable.GetPostofficesPath() & "\" & sPostoffice & "\MAILROOT\" & sMailbox & "\AUTORESPOND.CFG"
|
||||
|
||||
If Not File.Exists(SourcePath) Then
|
||||
Return 1
|
||||
End If
|
||||
|
||||
File.Copy(SourcePath, TargetPath, True)
|
||||
SetAutoResponderStatus = 1
|
||||
Else
|
||||
SourcePath = MailEnable.GetPostofficesPath() & "\" & sPostoffice & "\MAILROOT\" & sMailbox & "\AUTORESPOND.CFG"
|
||||
|
||||
If Not File.Exists(SourcePath) Then
|
||||
Return 1
|
||||
End If
|
||||
|
||||
File.Delete(SourcePath)
|
||||
SetAutoResponderStatus = 1
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function SetAutoResponderContents(ByVal Headers As String, ByVal MessageBody As String) As Integer
|
||||
Return SetAutoResponderContents(Me.Postoffice, Me.MailboxName, Headers, MessageBody)
|
||||
End Function
|
||||
|
||||
Public Shared Function SetAutoResponderContents(ByVal sPostoffice As String, ByVal sMailbox As String, ByVal Headers As String, ByVal MessageBody As String) As Integer
|
||||
'
|
||||
' This function sets the contents of the autoresponse.
|
||||
' The SetAutoResponderStatus routine must be called after this to make the changes effective
|
||||
'
|
||||
Dim SourcePath As String
|
||||
|
||||
SourcePath = MailEnable.GetPostofficesPath() & "\" & sPostoffice & "\MAILROOT\" & sMailbox & "\AUTORESPOND.CF_"
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
Dim oTS As StreamWriter = New StreamWriter(SourcePath, False)
|
||||
|
||||
If Err.Number = 0 Then
|
||||
oTS.Write(Headers & vbCrLf & vbCrLf & MessageBody)
|
||||
oTS.Close()
|
||||
SetAutoResponderContents = 1
|
||||
Else
|
||||
SetAutoResponderContents = 0
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Public Function GetAutoResponderSubject() As String
|
||||
'
|
||||
' This Routine returns the current AutoResponder Subject
|
||||
'
|
||||
Dim FileContents As String
|
||||
Dim DelimiterPos As Long
|
||||
Dim StartPos As Long
|
||||
Dim EndPos As Long
|
||||
Dim SubjectOffset As Long
|
||||
Dim SourcePath As String
|
||||
|
||||
SourcePath = MailEnable.GetPostofficesPath() & "\" & Me.Postoffice & "\MAILROOT\" & Me.MailboxName & "\AUTORESPOND.CF_"
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
If Not File.Exists(SourcePath) Then
|
||||
Return ""
|
||||
End If
|
||||
|
||||
Dim oTS As StreamReader = New StreamReader(SourcePath)
|
||||
|
||||
FileContents = oTS.ReadToEnd
|
||||
oTS.Close()
|
||||
|
||||
DelimiterPos = InStr(1, FileContents, "Subject:")
|
||||
|
||||
If DelimiterPos > 0 Then
|
||||
SubjectOffset = Len("Subject: ")
|
||||
StartPos = DelimiterPos + SubjectOffset
|
||||
EndPos = InStr(DelimiterPos, FileContents, vbCrLf, )
|
||||
GetAutoResponderSubject = Mid(FileContents, StartPos, (EndPos - StartPos))
|
||||
Else
|
||||
GetAutoResponderSubject = FileContents
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Public Function GetAutoResponderContents() As String
|
||||
'
|
||||
' This Routine returns the current AutoResponder Message
|
||||
'
|
||||
Dim FileContents As String
|
||||
Dim DelimiterPos As Long
|
||||
Dim SourcePath As String
|
||||
|
||||
SourcePath = MailEnable.GetPostofficesPath() & "\" & Me.Postoffice & "\MAILROOT\" & Me.MailboxName & "\AUTORESPOND.CF_"
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
If Not File.Exists(SourcePath) Then
|
||||
Return ""
|
||||
End If
|
||||
|
||||
Dim oTS As StreamReader = New StreamReader(SourcePath)
|
||||
|
||||
FileContents = oTS.ReadToEnd
|
||||
oTS.Close()
|
||||
|
||||
DelimiterPos = InStr(1, FileContents, vbCrLf & vbCrLf)
|
||||
|
||||
If DelimiterPos > 0 Then
|
||||
' It has headers
|
||||
' Headers = Mid(FileContents, 1, DelimiterPos + Len(vbCrLf & vbCrLf))
|
||||
GetAutoResponderContents = Mid$(FileContents, DelimiterPos + Len(vbCrLf & vbCrLf))
|
||||
Else
|
||||
'Headers = ""
|
||||
GetAutoResponderContents = FileContents
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Public Function GetAutoResponderStatus() As Boolean
|
||||
'
|
||||
' This Routine returns the current AutoResponder Status
|
||||
'
|
||||
Dim SourcePath As String
|
||||
|
||||
SourcePath = MailEnable.GetPostofficesPath() & "\" & Me.Postoffice & "\MAILROOT\" & Me.MailboxName & "\AUTORESPOND.CFG"
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
GetAutoResponderStatus = System.IO.File.Exists(SourcePath)
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Function SetSignature(ByVal Postoffice As String, ByVal Mailbox As String, ByVal SignitureText As String) As Integer
|
||||
Dim CAnnotation As IANNOTATIONTYPE
|
||||
CAnnotation.AccountName = Postoffice
|
||||
CAnnotation.AnnotationName = Mailbox & "-AUTOSIG"
|
||||
CAnnotation.AnnotationText = SignitureText
|
||||
SetSignature = AnnotationAdd(CAnnotation)
|
||||
End Function
|
||||
|
||||
Function GetSignature(ByVal Postoffice As String, ByVal Mailbox As String) As String
|
||||
|
||||
Dim CAnnotation As IANNOTATIONTYPE
|
||||
|
||||
CAnnotation.AccountName = Postoffice
|
||||
CAnnotation.AnnotationName = Mailbox & "-AUTOSIG"
|
||||
CAnnotation.AnnotationText = ""
|
||||
|
||||
If (AnnotationGet(CAnnotation) = 1) Then
|
||||
GetSignature = CAnnotation.AnnotationText
|
||||
Else
|
||||
GetSignature = ""
|
||||
End If
|
||||
End Function
|
||||
|
||||
|
||||
Public Property Postoffice() As String
|
||||
Get
|
||||
Return Me.PostofficeVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.PostofficeVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property MailboxName() As String
|
||||
Get
|
||||
Return Me.MailboxNameVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.MailboxNameVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property RedirectAddress() As String
|
||||
Get
|
||||
Return Me.RedirectAddressVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.RedirectAddressVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property RedirectStatus() As Long
|
||||
Get
|
||||
Return Me.RedirectStatusVal
|
||||
End Get
|
||||
Set(ByVal value As Long)
|
||||
Me.RedirectStatusVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Status() As Long
|
||||
Get
|
||||
Return Me.StatusVal
|
||||
End Get
|
||||
Set(ByVal value As Long)
|
||||
Me.StatusVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Limit() As Long
|
||||
Get
|
||||
Return Me.LimitVal
|
||||
End Get
|
||||
Set(ByVal value As Long)
|
||||
Me.LimitVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Size() As Long
|
||||
Get
|
||||
Return Me.SizeVal
|
||||
End Get
|
||||
Set(ByVal value As Long)
|
||||
Me.SizeVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Host() As String
|
||||
Get
|
||||
Return Me.HostVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.HostVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,166 @@
|
|||
Namespace WebsitePanel.Providers.Mail
|
||||
|
||||
Public Class MailEnableOption
|
||||
Inherits MarshalByRefObject
|
||||
|
||||
Private ScopeVal As Integer
|
||||
Private QueryVal As String
|
||||
Private ValueNameVal As String
|
||||
Private ValueVal As String
|
||||
Private HostVal As String
|
||||
|
||||
Private Declare Function SystemGetOption Lib "MEAISO.DLL" Alias "GetOption" (ByVal Scope As Integer, ByVal Query As String, ByVal ValueName As String, ByVal ReturnValue As String) As Int32
|
||||
Private Declare Function SystemSetOption Lib "MEAISO.DLL" Alias "SetOption" (ByVal Scope As Integer, ByVal Query As String, ByVal ValueName As String, ByVal ReturnValue As String) As Int32
|
||||
Private Declare Function SetCurrentHost Lib "MEAISO.DLL" (ByVal CurrentHost As String) As Int32
|
||||
|
||||
Private Shared 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 Shared Function CString(ByVal InString As String) As String
|
||||
CString = InString & Chr(0)
|
||||
End Function
|
||||
|
||||
Public Function SetHost() As Integer
|
||||
SetHost = SetCurrentHost(Host)
|
||||
End Function
|
||||
|
||||
Private Function ValidData() As Boolean
|
||||
If Len(Query) >= 1024 Then ValidData = False : Exit Function
|
||||
If Len(ValueName) >= 1024 Then ValidData = False : Exit Function
|
||||
If Len(Value) >= 1024 Then ValidData = False : Exit Function
|
||||
ValidData = True
|
||||
End Function
|
||||
|
||||
|
||||
Public Function GetOption() As Integer
|
||||
If Not ValidData() Then GetOption = 0 : Exit Function
|
||||
|
||||
Value = Space(2048)
|
||||
Try
|
||||
GetOption = SystemGetOption(Scope, Query, ValueName, Value)
|
||||
Value = NonCString(Value)
|
||||
Catch ex As Exception
|
||||
GetOption = 0
|
||||
Value = String.Empty
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function SetOption() As Integer
|
||||
If Not ValidData() Then SetOption = 0 : Exit Function
|
||||
|
||||
SetOption = SystemSetOption(Scope, Query, ValueName, Value)
|
||||
End Function
|
||||
|
||||
|
||||
Public Property Scope() As Integer
|
||||
Get
|
||||
Return Me.ScopeVal
|
||||
End Get
|
||||
Set(ByVal value As Integer)
|
||||
Me.ScopeVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Query() As String
|
||||
Get
|
||||
Return Me.QueryVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.QueryVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property ValueName() As String
|
||||
Get
|
||||
Return Me.ValueNameVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.ValueNameVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Value() As String
|
||||
Get
|
||||
Return Me.ValueVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.ValueVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Host() As String
|
||||
Get
|
||||
Return Me.HostVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.HostVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Public Shared Function GetSystemOption(ByRef lScope As String, ByRef sQuery As String, ByRef sValueName As String, Optional ByVal DefaultValue As String = "") As String
|
||||
|
||||
Dim oMEAOSO As New MailEnableOption
|
||||
|
||||
On Error Resume Next
|
||||
oMEAOSO.Scope = lScope
|
||||
oMEAOSO.Query = sQuery
|
||||
oMEAOSO.ValueName = sValueName
|
||||
If oMEAOSO.GetOption() <> 0 Then
|
||||
GetSystemOption = oMEAOSO.Value
|
||||
Else
|
||||
GetSystemOption = DefaultValue
|
||||
End If
|
||||
oMEAOSO = Nothing
|
||||
|
||||
End Function
|
||||
|
||||
Public Shared Function SetSystemOption(ByRef lScope As String, ByRef sQuery As String, ByRef sValueName As String, ByRef sValue As String) As Integer
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
If Not IsNothing(sValue) Then
|
||||
Dim oMEAOSO As New MailEnableOption
|
||||
|
||||
oMEAOSO.Scope = lScope
|
||||
oMEAOSO.Query = sQuery
|
||||
oMEAOSO.ValueName = sValueName
|
||||
oMEAOSO.Value = sValue
|
||||
oMEAOSO.SetOption()
|
||||
SetSystemOption = True
|
||||
|
||||
oMEAOSO = Nothing
|
||||
Return 1
|
||||
End If
|
||||
|
||||
Return 0
|
||||
|
||||
End Function
|
||||
|
||||
Public Shared Function GetRemoteRegistryString(ByVal HostName As String, ByVal ParentKey As String, ByVal RegistryKey As String, ByRef KeyValue As String) As Integer
|
||||
If HostName Is Nothing Then
|
||||
HostName = ""
|
||||
End If
|
||||
Dim LocalValue As String = Space(4096)
|
||||
Dim Result As Integer = _GetRemoteRegistryString(HostName, ParentKey, RegistryKey, LocalValue)
|
||||
If Result = 1 Then
|
||||
KeyValue = NonCString(LocalValue)
|
||||
End If
|
||||
Return Result
|
||||
End Function
|
||||
|
||||
Private Declare Function GetRemoteRegistryWord Lib "MEAISO.DLL" (ByVal HostName As String, ByVal ParentKey As String, ByVal RegistryKey As String, ByVal KeyValue As Integer) As Integer
|
||||
Private Declare Function SetRemoteRegistryWord Lib "MEAISO.DLL" (ByVal HostName As String, ByVal ParentKey As String, ByVal RegistryKey As String, ByVal KeyValue As Integer) As Integer
|
||||
Private Declare Function SetRemoteRegistryString Lib "MEAISO.DLL" (ByVal HostName As String, ByVal ParentKey As String, ByVal RegistryKey As String, ByVal KeyValue As String) As Integer
|
||||
Private Declare Function _GetRemoteRegistryString Lib "MEAISO.DLL" Alias "GetRemoteRegistryString" (ByVal HostName As String, ByVal ParentKey As String, ByVal RegistryKey As String, ByVal KeyValue As String) As Integer
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,144 @@
|
|||
Namespace WebsitePanel.Providers.Mail
|
||||
|
||||
Public Class MailEnablePostoffice
|
||||
Inherits MarshalByRefObject
|
||||
|
||||
Private NameVal As String
|
||||
Private StatusVal As Long
|
||||
Private AccountVal As String
|
||||
Private HostVal As String
|
||||
|
||||
Private Structure IPOSTOFFICETYPE
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public Name As String
|
||||
Public Status As Integer
|
||||
<VBFixedString(128), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=128)> Public Account As String
|
||||
End Structure
|
||||
|
||||
|
||||
Private Declare Function PostofficeGet Lib "MEAIPO.DLL" (ByRef lpPostoffice As IPOSTOFFICETYPE) As Integer
|
||||
Private Declare Function PostofficeFindFirst Lib "MEAIPO.DLL" (ByRef lpPostoffice As IPOSTOFFICETYPE) As Integer
|
||||
Private Declare Function PostofficeFindNext Lib "MEAIPO.DLL" (ByRef lpPostoffice As IPOSTOFFICETYPE) As Integer
|
||||
Private Declare Function PostofficeAdd Lib "MEAIPO.DLL" (ByRef lpPostoffice As IPOSTOFFICETYPE) As Integer
|
||||
Private Declare Function PostofficeEdit Lib "MEAIPO.DLL" (ByRef TargetPostoffice As IPOSTOFFICETYPE, ByRef NewPostoffice As IPOSTOFFICETYPE) As Integer
|
||||
Private Declare Function PostofficeRemove Lib "MEAIPO.DLL" (ByRef lpPostoffice As IPOSTOFFICETYPE) As Integer
|
||||
Private Declare Function SetCurrentHost Lib "MEAIPO.DLL" (ByVal CurrentHost As String) As Integer
|
||||
|
||||
Public Function SetHost() As Integer
|
||||
SetHost = SetCurrentHost(Host)
|
||||
End Function
|
||||
|
||||
|
||||
Public Function FindFirstPostoffice() As Integer
|
||||
Dim CPostoffice As IPOSTOFFICETYPE
|
||||
CPostoffice.Account = Account
|
||||
CPostoffice.Name = Name
|
||||
CPostoffice.Status = Status
|
||||
FindFirstPostoffice = PostofficeFindFirst(CPostoffice)
|
||||
Account = CPostoffice.Account
|
||||
Name = CPostoffice.Name
|
||||
Status = CPostoffice.Status
|
||||
End Function
|
||||
Public Function FindNextPostoffice() As Integer
|
||||
Dim CPostoffice As IPOSTOFFICETYPE
|
||||
CPostoffice.Account = Account
|
||||
CPostoffice.Name = Name
|
||||
CPostoffice.Status = Status
|
||||
FindNextPostoffice = PostofficeFindNext(CPostoffice)
|
||||
Account = CPostoffice.Account
|
||||
Name = CPostoffice.Name
|
||||
Status = CPostoffice.Status
|
||||
End Function
|
||||
|
||||
Public Function AddPostoffice() As Integer
|
||||
Dim CPostoffice As IPOSTOFFICETYPE
|
||||
CPostoffice.Account = Account
|
||||
CPostoffice.Name = Name
|
||||
CPostoffice.Status = Status
|
||||
AddPostoffice = PostofficeAdd(CPostoffice)
|
||||
Account = CPostoffice.Account
|
||||
Name = CPostoffice.Name
|
||||
Status = CPostoffice.Status
|
||||
End Function
|
||||
|
||||
Public Function GetPostoffice() As Integer
|
||||
Dim CPostoffice As IPOSTOFFICETYPE
|
||||
CPostoffice.Account = Account
|
||||
CPostoffice.Name = Name
|
||||
CPostoffice.Status = Status
|
||||
GetPostoffice = PostofficeGet(CPostoffice)
|
||||
Account = CPostoffice.Account
|
||||
Name = CPostoffice.Name
|
||||
Status = CPostoffice.Status
|
||||
End Function
|
||||
Public Function RemovePostoffice() As Integer
|
||||
Dim CPostoffice As IPOSTOFFICETYPE
|
||||
CPostoffice.Account = Account
|
||||
CPostoffice.Name = Name
|
||||
CPostoffice.Status = Status
|
||||
RemovePostoffice = PostofficeRemove(CPostoffice)
|
||||
Account = CPostoffice.Account
|
||||
Name = CPostoffice.Name
|
||||
Status = CPostoffice.Status
|
||||
End Function
|
||||
|
||||
|
||||
Public Function EditPostoffice(ByVal NewName As String, ByVal NewStatus As Long, ByVal NewAccount As String) As Integer
|
||||
|
||||
Dim CPostoffice As IPOSTOFFICETYPE
|
||||
Dim CPostofficeData As IPOSTOFFICETYPE
|
||||
|
||||
' Get the Find Stuff Set up
|
||||
CPostoffice.Account = Account
|
||||
CPostoffice.Name = Name
|
||||
CPostoffice.Status = Status
|
||||
' Get the Data Set up
|
||||
CPostofficeData.Account = NewAccount
|
||||
CPostofficeData.Name = NewName
|
||||
CPostofficeData.Status = NewStatus
|
||||
EditPostoffice = PostofficeEdit(CPostoffice, CPostofficeData)
|
||||
Account = CPostoffice.Account
|
||||
Name = CPostoffice.Name
|
||||
Status = CPostoffice.Status
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Property Name() As String
|
||||
Get
|
||||
Return Me.NameVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.NameVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Status() As Long
|
||||
Get
|
||||
Return Me.StatusVal
|
||||
End Get
|
||||
Set(ByVal value As Long)
|
||||
Me.StatusVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Account() As String
|
||||
Get
|
||||
Return Me.AccountVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.AccountVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Host() As String
|
||||
Get
|
||||
Return Me.HostVal
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
Me.HostVal = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
Loading…
Add table
Add a link
Reference in a new issue