From 0d19fbf3ddab8174ea08add0f692fbb5f024e642 Mon Sep 17 00:00:00 2001 From: Dan Date: Sat, 26 May 2012 13:55:35 +0100 Subject: [PATCH] A new solution for commit "ea82271b61ea" to fix and add features to hMailServer but only to version 5 and up. + Fix workitem/255 --- WebsitePanel/Database/install_db.sql | 6 +- WebsitePanel/Database/update_db.sql | 14 + ...tePanel.Providers.Mail.hMailServer5.vbproj | 4 - .../hMailServer5.vb | 1270 ++++++++++++++++- .../hMailServer.vb | 340 ++--- .../hMailServer43_EditAccount.ascx.resx | 37 +- .../hMailServer5_EditAccount.ascx.resx | 201 +++ .../hMailServer5_EditDomain.ascx.resx | 132 ++ .../hMailServer5_EditGroup.ascx.resx | 123 ++ .../hMailServer5_EditList.ascx.resx | 147 ++ .../hMailServer5_Settings.ascx.resx | 132 ++ .../hMailServer43_EditAccount.ascx | 77 +- .../hMailServer43_EditAccount.ascx.cs | 21 +- ...hMailServer43_EditAccount.ascx.designer.cs | 146 +- .../hMailServer5_EditAccount.ascx | 177 +++ .../hMailServer5_EditAccount.ascx.cs | 93 ++ .../hMailServer5_EditAccount.ascx.designer.cs | 402 ++++++ .../hMailServer5_EditDomain.ascx | 9 + .../hMailServer5_EditDomain.ascx.cs | 87 ++ .../hMailServer5_EditDomain.ascx.designer.cs | 33 + .../hMailServer5_EditForwarding.ascx | 1 + .../hMailServer5_EditForwarding.ascx.cs | 60 + ...ailServer5_EditForwarding.ascx.designer.cs | 15 + .../hMailServer5_EditGroup.ascx | 12 + .../hMailServer5_EditGroup.ascx.cs | 60 + .../hMailServer5_EditGroup.ascx.designer.cs | 33 + .../hMailServer5_EditList.ascx | 48 + .../hMailServer5_EditList.ascx.cs | 77 + .../hMailServer5_EditList.ascx.designer.cs | 105 ++ .../hMailServer5_Settings.ascx | 35 + .../hMailServer5_Settings.ascx.cs | 64 + .../hMailServer5_Settings.ascx.designer.cs | 87 ++ .../WebsitePanel.Portal.Modules.csproj | 63 + 33 files changed, 3588 insertions(+), 523 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditAccount.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditDomain.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditGroup.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditList.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_Settings.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditAccount.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditAccount.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditAccount.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditDomain.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditDomain.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditDomain.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditForwarding.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditForwarding.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditForwarding.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditGroup.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditGroup.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditGroup.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditList.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditList.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditList.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_Settings.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_Settings.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_Settings.ascx.designer.cs diff --git a/WebsitePanel/Database/install_db.sql b/WebsitePanel/Database/install_db.sql index 75fc6abe..a85b7c2a 100644 --- a/WebsitePanel/Database/install_db.sql +++ b/WebsitePanel/Database/install_db.sql @@ -23222,7 +23222,7 @@ INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName] GO INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (62, 8, N'SmarterStats', N'SmarterStats 5.x-6.x', N'WebsitePanel.Providers.Statistics.SmarterStats5, WebsitePanel.Providers.Statistics.SmarterStats', N'SmarterStats', NULL) GO -INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (63, 4, N'hMailServer5', N'hMailServer 5.x', N'WebsitePanel.Providers.Mail.hMailServer5, WebsitePanel.Providers.Mail.hMailServer5', N'hMailServer43', NULL) +INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (63, 4, N'hMailServer5', N'hMailServer 5.x', N'WebsitePanel.Providers.Mail.hMailServer5, WebsitePanel.Providers.Mail.hMailServer5', N'hMailServer5', NULL) GO INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (64, 4, N'SmarterMail', N'SmarterMail 7.x', N'WebsitePanel.Providers.Mail.SmarterMail7, WebsitePanel.Providers.Mail.SmarterMail7', N'SmarterMail60', NULL) GO @@ -24361,6 +24361,10 @@ INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [Property GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (62, N'Username', N'Admin') GO +INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (63, N'AdminPassword', N'') +GO +INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (63, N'AdminUsername', N'Administrator') +GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (64, N'AdminPassword', N'') GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (64, N'AdminUsername', N'admin') diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 950e401e..8a72f451 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -827,3 +827,17 @@ BEGIN END GO +UPDATE [dbo].[Providers] SET [EditorControl] = N'hMailServer5' WHERE [ProviderID] = 63 +GO + +IF NOT EXISTS (SELECT * FROM [dbo].[ServiceDefaultProperties] WHERE [ProviderID] = 63 AND [PropertyName] = N'AdminUsername') +BEGIN + INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (63, N'AdminUsername', N'Administrator') +END +GO + +IF NOT EXISTS (SELECT * FROM [dbo].[ServiceDefaultProperties] WHERE [ProviderID] = 63 AND [PropertyName] = N'AdminPassword') +BEGIN + INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (63, N'AdminPassword', N'') +END +GO \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.hMail5/WebsitePanel.Providers.Mail.hMailServer5.vbproj b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.hMail5/WebsitePanel.Providers.Mail.hMailServer5.vbproj index 3a556d7c..bd9f74f1 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.hMail5/WebsitePanel.Providers.Mail.hMailServer5.vbproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.hMail5/WebsitePanel.Providers.Mail.hMailServer5.vbproj @@ -117,10 +117,6 @@ {684C932A-6C75-46AC-A327-F3689D89EB42} WebsitePanel.Providers.Base - - {67EEA793-8621-4AD2-AE1D-4D975A8DA059} - WebsitePanel.Providers.Mail.hMailServer - {E91E52F3-9555-4D00-B577-2B1DBDD87CA7} WebsitePanel.Server.Utils diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.hMail5/hMailServer5.vb b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.hMail5/hMailServer5.vb index 5298fd30..158a72f3 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.hMail5/hMailServer5.vb +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.hMail5/hMailServer5.vb @@ -36,7 +36,13 @@ Imports Microsoft.Win32 Imports WebsitePanel.Server.Utils Public Class hMailServer5 - Inherits hMailServer + Inherits HostingServiceProviderBase + Implements IMailServer + + Private Const APPLICATION_PROG_ID As String = "hMailServer.Application" + Private Const WEBSITEPANEL_RULE_NAME As String = "WebsitePanel" + Private Const MAIL_GROUP_RULE As String = "Mail Group Rule" + Private Const FORWARDING_RULE As String = "Forwarding Rule" #Region "Public Properties" Public ReadOnly Property AdminUsername() As String @@ -52,9 +58,9 @@ Public Class hMailServer5 End Property #End Region - Protected Overrides ReadOnly Property hMailServer() As Object + Protected ReadOnly Property hMailServer() As Object Get - Dim svc As Object = MyBase.hMailServer + Dim svc As Object = CreateObject(APPLICATION_PROG_ID) ' Authenticate API Dim account As Object = svc.Authenticate(AdminUsername, AdminPassword) @@ -66,6 +72,1261 @@ Public Class hMailServer5 End Get End Property + Class Service + Public ComObject As Object + Public Succeed As Boolean + End Class + +#Region "Private Helper methods" + Private Function CheckAccountIsGroup(ByVal objAccount As Object) As Boolean + If objAccount.Rules.Count > 0 Then + ' check rule actions + Dim objRule As Object = objAccount.Rules.Item(0) + ' first read rule name + If String.Compare(objRule.Name, MAIL_GROUP_RULE, True) = 0 Then + Return True + Else ' read rule actions + For j As Integer = 0 To objRule.Actions.Count - 1 + If objRule.Actions.Item(j).Type = 1 Then 'eRADeleteEmail + Return True + End If + Next + End If + End If + Return False + End Function + + Private Function GetAccountForwardings(ByVal objAccount As Object) As String() + Dim forwardings As List(Of String) = New List(Of String) + If objAccount.Rules.Count > 0 Then + ' check rule actions + Dim objRule As Object = objAccount.Rules.Item(0) + Dim j As Integer + For j = 0 To objRule.Actions.Count - 1 + If objRule.Actions.Item(j).Type = 2 Then 'eRAForwardEmail + forwardings.Add(objRule.Actions.Item(j).To) + End If + Next + End If + Return forwardings.ToArray() + End Function + + Private Function GetMailboxName(ByVal email As String) As String + If (email.IndexOf("@") = -1) Then + Return email + End If + Return email.Substring(0, email.IndexOf("@")) + End Function + + Private Function GetDomainName(ByVal email As String) As String + Return email.Substring(email.IndexOf("@") + 1) + End Function + + Private Function GetUtilitiesObject() As Service + ' find existing domain + Dim objDomain As New Service() + objDomain.Succeed = False + + Try + objDomain.ComObject = hMailServer.Utilities + objDomain.Succeed = True + Catch ex As Exception + Log.WriteError("Couldn't create hMailServer.Application Utilities ActiveX object.", ex) + End Try + + Return objDomain + End Function + + Private Function GetSettingsObject() As Service + Dim objSettings As New Service() + objSettings.Succeed = False + + Try + objSettings.ComObject = hMailServer.Settings + objSettings.Succeed = True + Catch ex As Exception + Log.WriteError("Couldn't create hMailServer.Application Settings ActiveX object.", ex) + End Try + + Return objSettings + End Function + + Private Function GetDomainObject(ByVal domainName As String) As Service + ' find existing domain + Dim objDomain As New Service() + objDomain.Succeed = False + + Try + objDomain.ComObject = hMailServer.Domains.ItemByName(domainName) + objDomain.Succeed = True + Catch ex As Exception + Log.WriteError("Couldn't create hMailServer.Application Domain ActiveX object.", ex) + End Try + + Return objDomain + End Function + + Private Function GetDomainsObject() As Service + ' find existing domain + Dim objDomain As New Service() + objDomain.Succeed = False + + Try + objDomain.ComObject = hMailServer.Domains + objDomain.Succeed = True + Catch ex As Exception + Log.WriteError("Couldn't create hMailServer.Application ActiveX object.", ex) + End Try + + Return objDomain + End Function + + Protected Overridable Function ConvertToMailList(ByRef objMailList As Object) As MailList + Dim mailList As New MailList() + + mailList.Enabled = objMailList.Active + mailList.Name = objMailList.Address + mailList.RequireSmtpAuthentication = objMailList.RequireSMTPAuth + + 'If objMailList.RequireSMTPAuth Then + 'mailList.PostingMode = PostingMode.MembersCanPost + 'ElseIf Not String.IsNullOrEmpty(objMailList.RequireSenderAddress) Then + 'mailList.PostingMode = PostingMode.ModeratorCanPost + 'mailList.ModeratorAddress = objMailList.RequireSenderAddress + 'Else + 'mailList.PostingMode = PostingMode.AnyoneCanPost + 'End If + + If objMailList.Mode = 1 Then + mailList.PostingMode = PostingMode.MembersCanPost + ElseIf Not String.IsNullOrEmpty(objMailList.RequireSenderAddress) And (objMailList.Mode = 2) Then + mailList.PostingMode = PostingMode.ModeratorCanPost + mailList.ModeratorAddress = objMailList.RequireSenderAddress + Else + mailList.PostingMode = PostingMode.AnyoneCanPost + End If + + ' load list members + Dim membersCount As Integer = objMailList.Recipients.Count - 1 + + Dim objRecipient As Object + If membersCount > 0 Then + mailList.Members = New String(membersCount) {} + For index As Integer = 0 To membersCount + objRecipient = objMailList.Recipients.Item(index) + mailList.Members(index) = objRecipient.RecipientAddress + Next index + Else + 'case when list has one member + If membersCount = 0 Then + mailList.Members = New String(1) {} + objRecipient = objMailList.Recipients.Item(0) + mailList.Members(0) = objRecipient.RecipientAddress + End If + End If + 'membersCount = -1 - list does not have members + + Return mailList + End Function + + Protected Overridable Function ConvertToMailGroup(ByRef objMailGroup As Object) As MailGroup + Dim mailGroup As New MailGroup() + + mailGroup.Name = objMailGroup.Address + mailGroup.Enabled = objMailGroup.Active + 'mailGroup.DiskSpace = objMailGroup.MaxSize + + Dim objGroupRules As Object = objMailGroup.Rules + Dim rulesCount As Integer = objGroupRules.Count - 1 + + Dim objGroupRule As Object = Nothing + ' find mail group rule + For i As Integer = 0 To rulesCount + objGroupRule = objMailGroup.Rules.Item(i) + If String.Compare(objGroupRule.Name, MAIL_GROUP_RULE, True) = 0 Then + Exit For + End If + Next i + + If Not objGroupRule Is Nothing Then + Dim groupMembers As New List(Of String) + Dim actionsCount As Integer = objGroupRule.Actions.Count - 1 + + ' copy group members + For i As Integer = 0 To actionsCount + Dim objRuleAction As Object = objGroupRule.Actions.Item(i) + If objRuleAction.Type = 2 Then 'eRAForwardEmail + groupMembers.Add(objRuleAction.To) + End If + Next i + + mailGroup.Members = New String(groupMembers.Count) {} + groupMembers.CopyTo(mailGroup.Members) + End If + + Return mailGroup + End Function + + Private Function GetDailyStatistics(ByVal since As DateTime, ByVal mailDomainName As String, ByVal logpath As String) As DailyStatistics() + Dim days As New ArrayList() + Dim now As DateTime = DateTime.Now + Dim [date] As DateTime = since + Dim mailDomainBytesReceived As Long = 0 + Dim mailDomainBytesSent As Long = 0 + + Try + While [date] < now + If File.Exists(logpath) Then + + Using r As StreamReader = New StreamReader(logpath) + Dim line As String + ' Read first line. + line = r.ReadLine + + Do While (Not line Is Nothing) + Dim vals As String() = line.Split(vbTab) + If vals.Length = 9 Then + Dim logDate As DateTime = CType(vals(0), DateTime) + If logDate >= [date] Then + 'get sent bytes + If InStr(vals(1), mailDomainName) Then + mailDomainBytesSent += Int32.Parse(vals(8)) + End If + + 'get received bytes + If InStr(vals(2), mailDomainName) Then + mailDomainBytesReceived += Int32.Parse(vals(8)) + End If + End If + If logDate.Date > [date].Date Then + Exit Do + End If + + End If + + line = r.ReadLine + + Loop + End Using + End If + + If mailDomainBytesReceived <> 0 Or mailDomainBytesSent <> 0 Then + Dim dailyStats As New DailyStatistics() + dailyStats.Year = [date].Year + dailyStats.Month = [date].Month + dailyStats.Day = [date].Day + dailyStats.BytesSent = mailDomainBytesSent + dailyStats.BytesReceived = mailDomainBytesReceived + days.Add(dailyStats) + End If + + ' advance day + [date] = [date].AddDays(1) + mailDomainBytesReceived = 0 + mailDomainBytesSent = 0 + End While + Catch ex As Exception + Log.WriteError("Could't parse hMailServer Awstats Log", ex) + End Try + Return DirectCast(days.ToArray(GetType(DailyStatistics)), DailyStatistics()) + End Function +#End Region + +#Region "IMailServer members" + Public Function AccountExists(ByVal mailboxName As String) As Boolean Implements IMailServer.AccountExists + ' find existing domain + Dim objDomain As Service = GetDomainObject(GetDomainName(mailboxName)) + + If objDomain.Succeed Then + ' find existing account + Dim i As Integer + For i = 0 To objDomain.ComObject.Accounts.Count - 1 + If String.Compare(objDomain.ComObject.Accounts.Item(i).Address, mailboxName, True) = 0 Then + Return True + End If + Next + End If + + Return False + End Function + + Public Sub AddDomainAlias(ByVal domainName As String, ByVal aliasName As String) Implements IMailServer.AddDomainAlias + ' find existing domain + Dim objDomain As Service = GetDomainObject(domainName) + + If objDomain.Succeed Then + ' add domain alias + Dim objAlias As Object = objDomain.ComObject.DomainAliases.Add() + objAlias.DomainID = objDomain.ComObject.ID + objAlias.AliasName = aliasName + objAlias.Save() + objDomain.ComObject.DomainAliases.Refresh() + End If + End Sub + + Public Sub CreateAccount(ByVal mailbox As MailAccount) Implements IMailServer.CreateAccount + ' find existing domain + Dim objDomain As Service = GetDomainObject(GetDomainName(mailbox.Name)) + + If objDomain.Succeed Then + ' add account + Dim objAccount As Object = objDomain.ComObject.Accounts.Add() + objAccount.DomainID = objDomain.ComObject.ID + objAccount.Address = mailbox.Name + objAccount.Active = mailbox.Enabled + objAccount.Password = mailbox.Password + objAccount.MaxSize = mailbox.MaxMailboxSize + objAccount.PersonFirstName = mailbox.FirstName + objAccount.PersonLastName = mailbox.FirstName + objAccount.SignatureEnabled = mailbox.SignatureEnabled + objAccount.SignaturePlainText = mailbox.Signature + objAccount.SignatureHTML = mailbox.SignatureHTML + + If mailbox.ResponderEnabled Then + objAccount.VacationMessageIsOn = True + objAccount.VacationSubject = mailbox.ResponderSubject + objAccount.VacationMessage = mailbox.ResponderMessage + objAccount.VacationMessageExpires = False + If mailbox.ResponderExpires Then + If IsDate(mailbox.ResponderExpirationDate) Then + objAccount.VacationMessageExpires = True + objAccount.VacationMessageExpiresDate = mailbox.ResponderExpirationDate.Substring(0, 10) + End If + End If + End If + + 'set forwarding address + If mailbox.ForwardingEnabled Then + objAccount.ForwardAddress = mailbox.ForwardingAddresses(0) + objAccount.ForwardEnabled = True + objAccount.ForwardKeepOriginal = mailbox.RetainLocalCopy + End If + + objAccount.Save() + + ' set account rules + SetAccountRules(mailbox, objAccount) + + + End If + End Sub + + Private Sub SetAccountRules(ByVal mailbox As MailAccount, ByVal objAccount As Object) + ' check for default WebsitePanel rule + Dim ruleExists As Boolean = False + Dim objRule As Object = Nothing + + For i As Integer = 0 To objAccount.Rules.Count - 1 + objRule = objAccount.Rules.Item(i) + If String.Compare(objRule.Name, WEBSITEPANEL_RULE_NAME, True) = 0 Then + ruleExists = True + Exit For + End If + Next i + + If ruleExists Then + ' delete forwarding rule + objAccount.Rules.DeleteByDBID(objRule.ID) + End If + End Sub + + Public Sub CreateDomain(ByVal domain As MailDomain) Implements IMailServer.CreateDomain + Dim objDomain As New Service() + + objDomain.ComObject = hMailServer.Domains.Add() + objDomain.ComObject.Name = domain.Name + objDomain.ComObject.Active = domain.Enabled + objDomain.ComObject.Postmaster = domain.CatchAllAccount + objDomain.ComObject.Save() + End Sub + + Public Sub CreateGroup(ByVal group As MailGroup) Implements IMailServer.CreateGroup + Dim objDomain As Service = GetDomainObject(GetDomainName(group.Name)) + Dim objGroup As Object = Nothing + + If objDomain.Succeed Then + Dim Length As Integer = objDomain.ComObject.Accounts.Count - 1 + + ' check whether a group is already created + For index As Integer = 0 To Length + Dim objAccount As Object = objDomain.ComObject.Accounts.Item(index) + If CheckAccountIsGroup(objAccount) Then + If String.Compare(objAccount.Address, group.Name, True) = 0 Then + objGroup = objAccount + Exit For + End If + End If + Next index + + ' throw an exception + If Not objGroup Is Nothing Then + Throw New Exception("Group is already exsists.") + End If + + objGroup = objDomain.ComObject.Accounts.Add() + objGroup.DomainID = objDomain.ComObject.ID + objGroup.Address = group.Name + objGroup.Active = group.Enabled + objGroup.AdminLevel = 0 ' hAdminLevelNormal + + ' group should be empty + 'objGroup.MaxSize = group.DiskSpace + objGroup.VacationMessageIsOn = False + objGroup.VacationSubject = String.Empty + objGroup.VacationMessage = String.Empty + objGroup.Save() + + ' Create mail group rule + Dim objRule As Object = objGroup.Rules.Add() + objRule.AccountID = objGroup.ID + objRule.Active = True + objRule.Name = MAIL_GROUP_RULE + objRule.Save() + + ' Add criteria + Dim objCriteria As Object = objRule.Criterias.Add() + objCriteria.RuleID = objRule.ID + objCriteria.PredefinedField = 6 ' hMailServer.eRulePredefinedField.eFTMessageSize + objCriteria.MatchType = 4 ' hMailServer.eRuleMatchType.eMTGreaterThan + objCriteria.MatchValue = "0" + objCriteria.Save() + + ' create group members + If Not group.Members Is Nothing Then + For Each member As String In group.Members + Dim objGroupMemberAction As Object = objRule.Actions.Add() + objGroupMemberAction.RuleID = objRule.ID + objGroupMemberAction.Type = 2 'eRAForwardEmail + objGroupMemberAction.To = member + objGroupMemberAction.Save() + Next member + End If + + ' Add delete mail action + Dim objGroupAction As Object = objRule.Actions.Add() + objGroupAction.RuleID = objRule.ID + objGroupAction.Type = 1 'eRADeleteEmail + objGroupAction.Save() + + End If + End Sub + + Public Sub CreateList(ByVal maillist As MailList) Implements IMailServer.CreateList + Dim objDomain As Service = GetDomainObject(GetDomainName(maillist.Name)) + + If objDomain.Succeed Then + Dim objMailList As Object = objDomain.ComObject.DistributionLists.Add() + objMailList.Active = maillist.Enabled + objMailList.Address = maillist.Name + + Select Case maillist.PostingMode + Case PostingMode.MembersCanPost + objMailList.RequireSMTPAuth = True + Case PostingMode.ModeratorCanPost + If String.IsNullOrEmpty(maillist.ModeratorAddress) Then + Throw New Exception("List moderator address doesn't specified.") + End If + objMailList.RequireSenderAddress = maillist.ModeratorAddress + End Select + + objMailList.Save() + + ' save list members + If Not maillist.Members Is Nothing Then + For Each member As String In maillist.Members + Dim objRecipient As Object = objMailList.Recipients.Add() + objRecipient.RecipientAddress = member + objRecipient.Save() + Next member + End If + End If + End Sub + + Public Sub DeleteAccount(ByVal mailboxName As String) Implements IMailServer.DeleteAccount + Dim objDomain As Service = GetDomainObject(GetDomainName(mailboxName)) + + If objDomain.Succeed Then + Dim index As Integer + + ' find and remove account if exists + For index = 0 To objDomain.ComObject.Accounts.Count - 1 + Dim objAccount As Object = objDomain.ComObject.Accounts.Item(index) + If String.Compare(objAccount.Address, mailboxName, True) = 0 Then + objDomain.ComObject.Accounts.Delete(index) + Exit For + End If + Next + + ' find and remove alias if exists + For index = 0 To objDomain.ComObject.Aliases.Count - 1 + Dim objAlias As Object = objDomain.ComObject.Aliases.Item(index) + If String.Compare(objAlias.Name, mailboxName, True) = 0 Then + objDomain.ComObject.Aliases.Delete(index) + Exit For + End If + Next + End If + End Sub + + Public Function MailAliasExists(ByVal mailAliasName As String) As Boolean Implements IMailServer.MailAliasExists + ' find existing domain + Dim objDomain As Service = GetDomainObject(GetDomainName(mailAliasName)) + + If objDomain.Succeed Then + Try + ' find existing account + Dim i As Integer + For i = 0 To objDomain.ComObject.Aliases.Count - 1 + If String.Compare(objDomain.ComObject.Aliases.Item(i).Address, mailAliasName, True) = 0 Then + Return True + End If + Next + Catch ex As Exception + Log.WriteError("Couldn't determine if mail alias exists.", ex) + End Try + End If + + Return False + End Function + + Public Function GetMailAliases(ByVal domainName As String) As MailAlias() Implements IMailServer.GetMailAliases + Dim aliases As New List(Of MailAlias) + + ' find existing domain + Dim objDomain As Service = GetDomainObject(domainName) + + If objDomain.Succeed Then + Try + ' get all domain accounts + Dim i As Integer + For i = 0 To objDomain.ComObject.Aliases.Count - 1 + Dim objAccount As Object = objDomain.ComObject.Aliases.Item(i) + + + ' get account details + Dim mailAlias As MailAlias = New MailAlias() + mailAlias.Name = objAccount.Name + mailAlias.Enabled = objAccount.Active + mailAlias.ForwardTo = objAccount.Value + aliases.Add(mailAlias) + Next + Catch ex As Exception + Log.WriteError("Couldn't get mail aliases.", ex) + End Try + End If + + Return aliases.ToArray() + End Function + + Public Function GetMailAlias(ByVal mailAliasName As String) As MailAlias Implements IMailServer.GetMailAlias + 'recreate alias if it was created incorrectly before + Dim mailAlias As New MailAlias + Dim newMailAlias As New MailAlias + + If AccountExists(mailAliasName) Then + Dim mailAccount As MailAccount = GetAccount(mailAliasName) + newMailAlias.Name = mailAccount.Name + newMailAlias.ForwardTo = mailAccount.ForwardingAddresses(0) + 'delete incorrect account + DeleteAccount(mailAliasName) + 'recreate mail alias + CreateMailAlias(newMailAlias) + Return newMailAlias + End If + + ' find existing domain + Dim objDomain As Service = GetDomainObject(GetDomainName(mailAliasName)) + + If objDomain.Succeed Then + Try + ' find through all domain accounts + For i As Integer = 0 To objDomain.ComObject.Aliases.Count - 1 + Dim objAccount As Object = objDomain.ComObject.Aliases.Item(i) + + If String.Compare(objAccount.Name, mailAliasName, True) = 0 Then + ' check if this is a Group + 'If CheckAccountIsGroup(objAccount) Then + 'Continue For + 'End If + + ' get account details + mailAlias.Name = objAccount.Name + mailAlias.Enabled = objAccount.Active + mailAlias.ForwardTo = objAccount.Value + Return mailAlias + End If + Next + Catch ex As Exception + Log.WriteError("Couldn't get mail alias.", ex) + End Try + End If + + Return Nothing + End Function + + Public Sub CreateMailAlias(ByVal mailAlias As MailAlias) Implements IMailServer.CreateMailAlias + Dim objDomain As Service = GetDomainObject(GetDomainName(mailAlias.Name)) + If objDomain.Succeed Then + Try + ' add alias + Dim objAlias As Object = objDomain.ComObject.Aliases.Add() + objAlias.DomainID = objDomain.ComObject.ID + objAlias.Name = mailAlias.Name + objAlias.Active = True + objAlias.Value = mailAlias.ForwardTo + objAlias.Save() + Catch ex As Exception + Log.WriteError("Couldn't create mail alias.", ex) + End Try + End If + End Sub + + Public Sub UpdateMailAlias(ByVal mailAlias As MailAlias) Implements IMailServer.UpdateMailAlias + ' find existing domain + Dim objDomain As Service = GetDomainObject(GetDomainName(mailAlias.Name)) + + If objDomain.Succeed Then + Try + ' find through all domain accounts + For i As Integer = 0 To objDomain.ComObject.Aliases.Count - 1 + Dim objAccount As Object = objDomain.ComObject.Aliases.Item(i) + + If String.Compare(objAccount.Name, mailAlias.Name, True) = 0 Then + 'Fix mail alias is disabled in hMail Server when update it in WSP + objAccount.Active = True + objAccount.Value = mailAlias.ForwardTo + objAccount.Save() + End If + Next + Catch ex As Exception + Log.WriteError("Couldn't update mail alias.", ex) + End Try + End If + End Sub + + Public Sub DeleteMailAlias(ByVal mailAliasName As String) Implements IMailServer.DeleteMailAlias + Dim objDomain As Service = GetDomainObject(GetDomainName(mailAliasName)) + If objDomain.Succeed Then + Try + Dim index As Integer + ' find and remove alias if exists + For index = 0 To objDomain.ComObject.Aliases.Count - 1 + Dim objAlias As Object = objDomain.ComObject.Aliases.Item(index) + If String.Compare(objAlias.Name, mailAliasName, True) = 0 Then + objDomain.ComObject.Aliases.Delete(index) + Exit For + End If + Next + Catch ex As Exception + Log.WriteError("Couldn't delete mail alias.", ex) + End Try + End If + End Sub + + Public Sub DeleteDomain(ByVal domainName As String) Implements IMailServer.DeleteDomain + ' find existing domain + Dim objDomain As Object + Try + objDomain = hMailServer.Domains.ItemByName(domainName) + Catch + Throw New Exception("Specified mail domain does not exists") + End Try + + ' delete domain + objDomain.Delete() + End Sub + + Public Sub DeleteDomainAlias(ByVal domainName As String, ByVal aliasName As String) Implements IMailServer.DeleteDomainAlias + ' find existing domain + Dim objDomain As Service = GetDomainObject(domainName) + + If objDomain.Succeed Then + Dim i As Integer + For i = 0 To objDomain.ComObject.DomainAliases.Count - 1 + If String.Compare(objDomain.ComObject.DomainAliases.Item(i).AliasName, aliasName, True) = 0 Then + objDomain.ComObject.DomainAliases.Delete(i) + Return + End If + Next + End If + End Sub + + Public Sub DeleteGroup(ByVal groupName As String) Implements IMailServer.DeleteGroup + DeleteAccount(groupName) + End Sub + + Public Sub DeleteList(ByVal maillistName As String) Implements IMailServer.DeleteList + Dim objDomain As Service = GetDomainObject(GetDomainName(maillistName)) + + If objDomain.Succeed Then + Dim objMailList = objDomain.ComObject.DistributionLists.ItemByAddress(maillistName) + + If Not objMailList Is Nothing Then + objMailList.Delete() + End If + End If + End Sub + + Public Function DomainAliasExists(ByVal domainName As String, ByVal aliasName As String) As Boolean Implements IMailServer.DomainAliasExists + ' find existing domain + Dim objDomain As Service = GetDomainObject(domainName) + + If objDomain.Succeed Then + ' check aliases + Dim i As Integer + For i = 0 To objDomain.ComObject.DomainAliases.Count - 1 + If String.Compare(objDomain.ComObject.DomainAliases.Item(i).AliasName, aliasName, True) = 0 Then + Return True + End If + Next + End If + + Return False + End Function + + Public Function DomainExists(ByVal domainName As String) As Boolean Implements IMailServer.DomainExists + Dim objDomain As Service = GetDomainObject(domainName) + + Return objDomain.Succeed + End Function + + Public Function GetAccount(ByVal mailboxName As String) As MailAccount Implements IMailServer.GetAccount + ' find existing domain + Dim objDomain As Service = GetDomainObject(GetDomainName(mailboxName)) + + If objDomain.Succeed Then + ' find through all domain accounts + For i As Integer = 0 To objDomain.ComObject.Accounts.Count - 1 + Dim objAccount As Object = objDomain.ComObject.Accounts.Item(i) + + If String.Compare(objAccount.Address, mailboxName, True) = 0 Then + ' check if this is a Group + If CheckAccountIsGroup(objAccount) Then + Continue For + End If + + ' get account details + Dim account As MailAccount = New MailAccount() + account.Name = objAccount.Address + account.FirstName = objAccount.PersonFirstName + account.LastName = objAccount.PersonLastName + account.Enabled = objAccount.Active + account.MaxMailboxSize = objAccount.MaxSize + account.Password = objAccount.Password + account.Size = objAccount.Size() + account.QuotaUsed = objAccount.QuotaUsed() + account.LastLogonTime = CType(objAccount.LastLogonTime(), DateTime) + 'auto-responder + account.ResponderEnabled = objAccount.VacationMessageIsOn + account.ResponderSubject = objAccount.VacationSubject + account.ResponderMessage = objAccount.VacationMessage + account.ResponderExpires = objAccount.VacationMessageExpires + account.ResponderExpirationDate = objAccount.VacationMessageExpiresDate + 'forwarding + account.ForwardingEnabled = objAccount.ForwardEnabled + Dim forwardings As List(Of String) = New List(Of String) + forwardings.Add(objAccount.ForwardAddress) + account.ForwardingAddresses = forwardings.ToArray + account.RetainLocalCopy = objAccount.ForwardKeepOriginal + 'Signature + account.SignatureEnabled = objAccount.SignatureEnabled + account.Signature = objAccount.SignaturePlainText + account.SignatureHTML = objAccount.SignatureHTML + Return account + End If + Next + + ' find through forwardings (hMail aliases) + For i As Integer = 0 To objDomain.ComObject.Aliases.Count - 1 + Dim objAlias As Object = objDomain.ComObject.Aliases.Item(i) + If String.Compare(objAlias.Name, mailboxName, True) = 0 Then + Dim account As MailAccount = New MailAccount() + account.Name = objAlias.Name + account.Enabled = objAlias.Active + account.ForwardingAddresses = New String() {objAlias.Value} + account.DeleteOnForward = True + Return account + End If + Next + End If + + Return Nothing + End Function + + Public Function GetAccounts(ByVal domainName As String) As MailAccount() Implements IMailServer.GetAccounts + Dim accounts As New List(Of MailAccount) + + ' find existing domain + Dim objDomain As Service = GetDomainObject(domainName) + + If objDomain.Succeed Then + ' get all domain accounts + Dim i As Integer + For i = 0 To objDomain.ComObject.Accounts.Count - 1 + Dim objAccount As Object = objDomain.ComObject.Accounts.Item(i) + + If CheckAccountIsGroup(objAccount) Then + Continue For + End If + + ' get account details + Dim account As MailAccount = New MailAccount() + account.Name = objAccount.Address + account.FirstName = objAccount.PersonFirstName + account.LastName = objAccount.PersonLastName + account.Enabled = objAccount.Active + account.MaxMailboxSize = objAccount.MaxSize + account.Password = objAccount.Password + account.Size = objAccount.Size() + account.QuotaUsed = objAccount.QuotaUsed() + account.LastLogonTime = CType(objAccount.LastLogonTime(), DateTime) + 'auto-responder + account.ResponderEnabled = objAccount.VacationMessageIsOn + account.ResponderSubject = objAccount.VacationSubject + account.ResponderMessage = objAccount.VacationMessage + account.ResponderExpires = objAccount.VacationMessageExpires + account.ResponderExpirationDate = objAccount.VacationMessageExpiresDate + 'forwarding + account.ForwardingEnabled = objAccount.ForwardEnabled + Dim forwardings As List(Of String) = New List(Of String) + forwardings.Add(objAccount.ForwardAddress) + account.ForwardingAddresses = forwardings.ToArray + account.RetainLocalCopy = objAccount.ForwardKeepOriginal + 'Signature + account.SignatureEnabled = objAccount.SignatureEnabled + account.Signature = objAccount.SignaturePlainText + account.SignatureHTML = objAccount.SignatureHTML + accounts.Add(account) + Next + End If + + Return accounts.ToArray() + End Function + + Public Overridable Function GetDomains() As String() Implements IMailServer.GetDomains + Dim objDomains As Service = GetDomainsObject() + + If objDomains.Succeed Then + Dim domains As New List(Of String) + + For Index As Integer = 0 To objDomains.ComObject.Count - 1 + domains.Add(objDomains.ComObject.Item(Index).Name) + Next + + Return domains.ToArray() + End If + + Return Nothing + End Function + + Public Function GetDomain(ByVal domainName As String) As MailDomain Implements IMailServer.GetDomain + Dim objDomain As Service = GetDomainObject(domainName) + + If objDomain.Succeed Then + Dim domain As MailDomain = New MailDomain() + domain.Name = objDomain.ComObject.Name + domain.Enabled = objDomain.ComObject.Active + domain.CatchAllAccount = GetMailboxName(objDomain.ComObject.Postmaster) + Return domain + End If + + Return Nothing + End Function + + Public Function GetDomainAliases(ByVal domainName As String) As String() Implements IMailServer.GetDomainAliases + ' find existing domain + Dim objDomain As Service = GetDomainObject(domainName) + Dim aliases As New List(Of String) + + If objDomain.Succeed Then + For i As Integer = 0 To objDomain.ComObject.DomainAliases.Count - 1 + aliases.Add(objDomain.ComObject.DomainAliases.Item(i).AliasName) + Next + End If + + Return aliases.ToArray() + End Function + + Public Function GetGroup(ByVal groupName As String) As MailGroup Implements IMailServer.GetGroup + Dim objDomain As Service = GetDomainObject(GetDomainName(groupName)) + Dim mailGroup As MailGroup = Nothing + + If objDomain.Succeed Then + Dim mailboxCount As Integer = objDomain.ComObject.Accounts.Count - 1 + + For i As Integer = 0 To mailboxCount + Dim objAccount As Object = objDomain.ComObject.Accounts.Item(i) + + If String.Compare(objAccount.Address, groupName, True) = 0 Then + If CheckAccountIsGroup(objAccount) Then + mailGroup = ConvertToMailGroup(objAccount) + Exit For + End If + End If + Next i + End If + + Return mailGroup + End Function + + Public Function GetGroups(ByVal domainName As String) As MailGroup() Implements IMailServer.GetGroups + Dim objDomain As Service = GetDomainObject(domainName) + Dim mailGroups As New List(Of MailGroup) + + If objDomain.Succeed Then + Dim Count As Integer = objDomain.ComObject.Accounts.Count - 1 + For I As Integer = 0 To Count + Dim objAccount As Object = objDomain.ComObject.Accounts.Item(I) + If CheckAccountIsGroup(objAccount) Then + mailGroups.Add(ConvertToMailGroup(objAccount)) + End If + Next I + End If + + Return mailGroups.ToArray() + End Function + + Public Function GetList(ByVal maillistName As String) As MailList Implements IMailServer.GetList + Dim objDomain As Service = GetDomainObject(GetDomainName(maillistName)) + Dim mailList As MailList = Nothing + + If objDomain.Succeed Then + Dim objMailList As Object = objDomain.ComObject.DistributionLists.ItemByAddress(maillistName) + + If Not objMailList Is Nothing Then + mailList = ConvertToMailList(objMailList) + End If + End If + + Return mailList + End Function + + Public Function GetLists(ByVal domainName As String) As MailList() Implements IMailServer.GetLists + Dim objDomain As Service = GetDomainObject(domainName) + + Dim lists As New List(Of MailList) + + If objDomain.Succeed Then + Dim mailListCount As Integer = objDomain.ComObject.DistributionLists.Count - 1 + + For index As Integer = 0 To mailListCount + Dim objMailList As Object = objDomain.ComObject.DistributionLists.Item(index) + lists.Add(ConvertToMailList(objMailList)) + Next index + End If + + Return lists.ToArray() + End Function + + Public Function GroupExists(ByVal groupName As String) As Boolean Implements IMailServer.GroupExists + Dim objDomain As Service = GetDomainObject(GetDomainName(groupName)) + Dim exists As Boolean = False + + If objDomain.Succeed Then + Try + Dim objAccount As Object = objDomain.ComObject.Accounts.ItemByAddress(groupName) + exists = CheckAccountIsGroup(objAccount) + Catch ex As Exception + Log.WriteError("Couldn't find mail group.", ex) + End Try + End If + + Return exists + End Function + + Public Function ListExists(ByVal maillistName As String) As Boolean Implements IMailServer.ListExists + Dim objDomain As Service = GetDomainObject(GetDomainName(maillistName)) + Dim exists As Boolean = False + + If objDomain.Succeed Then + Try + Dim objMailList As Object = objDomain.ComObject.DistributionLists.ItemByAddress(maillistName) + exists = True + Catch ex As Exception + Log.WriteError("Couldn't find mail list.", ex) + End Try + End If + + Return exists + End Function + + Public Sub UpdateAccount(ByVal mailbox As MailAccount) Implements IMailServer.UpdateAccount + Dim objDomain As Service = GetDomainObject(GetDomainName(mailbox.Name)) + + If objDomain.Succeed Then + Try + ' update account + Dim objAccount As Object = objDomain.ComObject.Accounts.ItemByAddress(mailbox.Name) + objAccount.Active = mailbox.Enabled + objAccount.Password = mailbox.Password + objAccount.MaxSize = mailbox.MaxMailboxSize + 'Auto-Responder + objAccount.VacationMessageIsOn = mailbox.ResponderEnabled + objAccount.VacationSubject = mailbox.ResponderSubject + objAccount.VacationMessage = mailbox.ResponderMessage + objAccount.VacationMessageExpires = False + If mailbox.ResponderExpires Then + If IsDate(mailbox.ResponderExpirationDate) Then + objAccount.VacationMessageExpires = True + objAccount.VacationMessageExpiresDate = mailbox.ResponderExpirationDate.Substring(0, 10) + End If + End If + 'Personal Information + objAccount.PersonFirstName = mailbox.FirstName + objAccount.PersonLastName = mailbox.LastName + 'Signature + objAccount.SignatureEnabled = mailbox.SignatureEnabled + objAccount.SignaturePlainText = mailbox.Signature + objAccount.SignatureHTML = mailbox.SignatureHTML + 'Forwarding + If mailbox.ForwardingEnabled Then + If mailbox.ForwardingAddresses.Length > 0 Then + objAccount.ForwardAddress = mailbox.ForwardingAddresses(0) + objAccount.ForwardKeepOriginal = mailbox.RetainLocalCopy + objAccount.ForwardEnabled = True + End If + Else + objAccount.ForwardEnabled = False + End If + objAccount.Save() + + ' set account rules + SetAccountRules(mailbox, objAccount) + + Catch ex As Exception + Log.WriteError("Couldn't update an account.", ex) + End Try + End If + End Sub + + Public Sub UpdateDomain(ByVal domain As MailDomain) Implements IMailServer.UpdateDomain + ' find existing domain + Dim objDomain As Service = GetDomainObject(domain.Name) + + If objDomain.Succeed Then + ' update domain + objDomain.ComObject.Name = domain.Name + objDomain.ComObject.Active = domain.Enabled + objDomain.ComObject.Postmaster = String.Concat(domain.CatchAllAccount, "@", domain.Name) + objDomain.ComObject.Save() + End If + End Sub + + Public Sub UpdateGroup(ByVal group As MailGroup) Implements IMailServer.UpdateGroup + Dim objDomain As Service = GetDomainObject(GetDomainName(group.Name)) + + If objDomain.Succeed Then + Try + Dim objGroup As Object = objDomain.ComObject.Accounts.ItemByAddress(group.Name) + If CheckAccountIsGroup(objGroup) Then + objGroup.Active = group.Enabled + + ' group should be empty + 'objGroup.MaxSize = group.DiskSpace + objGroup.VacationMessageIsOn = False + objGroup.VacationSubject = String.Empty + objGroup.VacationMessage = String.Empty + objGroup.Save() + + Dim groupRuleExists As Boolean = False + Dim objRule As Object = Nothing + + For i As Integer = 0 To objGroup.Rules.Count - 1 + objRule = objGroup.Rules.Item(i) + If String.Compare(objRule.Name, MAIL_GROUP_RULE, True) = 0 Then + groupRuleExists = True + Exit For + End If + Next i + + If Not groupRuleExists Then + ' Create mail group rule + objRule = objGroup.Rules.Add() + objRule.AccountID = objGroup.ID + objRule.Active = True + objRule.Name = MAIL_GROUP_RULE + objRule.Save() + End If + + Dim criteriaExists As Boolean = False + Dim objCriteria As Object + ' Check for the criteria + For i As Integer = 0 To objRule.Criterias.Count - 1 + objCriteria = objRule.Criterias.Item(i) + + If objCriteria.PredefinedField = 6 And objCriteria.MatchType = 4 And objCriteria.MatchValue = "0" Then + criteriaExists = True + Exit For + End If + Next i + + If Not criteriaExists Then + ' Add criteria + objCriteria = objRule.Criterias.Add() + objCriteria.RuleID = objRule.ID + objCriteria.PredefinedField = 6 ' hMailServer.eRulePredefinedField.eFTMessageSize + objCriteria.MatchType = 4 ' hMailServer.eRuleMatchType.eMTGreaterThan + objCriteria.MatchValue = "0" + objCriteria.Save() + End If + + ' cleanup previous rule actions + Do + objRule.Actions.Delete(0) + Loop While objRule.Actions.Count > 0 + + + ' create group members + If Not group.Members Is Nothing Then + For Each member As String In group.Members + Dim objGroupMemberAction As Object = objRule.Actions.Add() + objGroupMemberAction.RuleID = objRule.ID + objGroupMemberAction.Type = 2 'eRAForwardEmail + objGroupMemberAction.To = member + objGroupMemberAction.Save() + Next member + End If + + ' Add delete mail action + Dim objGroupAction As Object = objRule.Actions.Add() + objGroupAction.RuleID = objRule.ID + objGroupAction.Type = 1 'eRADeleteEmail + objGroupAction.Save() + End If + Catch ex As Exception + Log.WriteError("Couldn't update specified mail group.", ex) + End Try + End If + End Sub + + Public Sub UpdateList(ByVal maillist As MailList) Implements IMailServer.UpdateList + Dim objDomain As Service = GetDomainObject(GetDomainName(maillist.Name)) + + If objDomain.Succeed Then + Try + Dim objMailList As Object = objDomain.ComObject.DistributionLists.ItemByAddress(maillist.Name) + objMailList.Active = maillist.Enabled + + objMailList.RequireSMTPAuth = maillist.RequireSmtpAuthentication + + Select Case maillist.PostingMode + Case PostingMode.MembersCanPost + objMailList.Mode = 1 + Case PostingMode.ModeratorCanPost + If String.IsNullOrEmpty(maillist.ModeratorAddress) Then + Throw New Exception("List moderator address doesn't specified.") + End If + objMailList.RequireSenderAddress = maillist.ModeratorAddress + objMailList.Mode = 2 + Case PostingMode.AnyoneCanPost + objMailList.Mode = 3 + End Select + + objMailList.Save() + + Dim count As Integer = objMailList.Recipients.Count + + ' cleanup list members + ' check if list has members to avoid Invalid Index exception + If objMailList.Recipients.Count > 0 Then + For i As Integer = 0 To objMailList.Recipients.Count - 1 + Dim objRecipient As Object = objMailList.Recipients.Item(0) + objRecipient.Delete() + Next i + End If + + + ' save list members + If Not maillist.Members Is Nothing Then + For Each member As String In maillist.Members + Dim objRecipient As Object = objMailList.Recipients.Add() + objRecipient.RecipientAddress = member + objRecipient.Save() + Next member + End If + + Catch ex As Exception + Log.WriteError("Couldn't update a mail list.", ex) + End Try + End If + End Sub +#End Region + +#Region "HostingServiceProviderBase" + + Public Overrides Sub ChangeServiceItemsState(ByVal items() As ServiceProviderItem, ByVal enabled As Boolean) + For Each item As ServiceProviderItem In items + If TypeOf item Is MailDomain Then + Try + Dim domain As MailDomain = GetDomain(item.Name) + domain.Enabled = enabled + UpdateDomain(domain) + Catch ex As Exception + Log.WriteError(String.Format("Error switching '{0}' mail domain", item.Name), ex) + End Try + End If + Next + End Sub + + Public Overrides Sub DeleteServiceItems(ByVal items() As ServiceProviderItem) + For Each item As ServiceProviderItem In items + If TypeOf item Is MailDomain Then + Try + DeleteDomain(item.Name) + Catch ex As Exception + Log.WriteError(String.Format("Error deleting '{0}' mail domain", item.Name), ex) + End Try + End If + Next + End Sub + + Public Overrides Function GetServiceItemsDiskSpace(ByVal items() As ServiceProviderItem) As ServiceProviderItemDiskSpace() + Dim itemsDiskspace As List(Of ServiceProviderItemDiskSpace) = New List(Of ServiceProviderItemDiskSpace) + Dim item As ServiceProviderItem + For Each item In items + If TypeOf item Is MailAccount Then + Try + Dim objDomain As Service = GetDomainObject(GetDomainName(item.Name)) + Dim objAccount = objDomain.ComObject.Accounts.ItemByAddress(item.Name) + Dim objAccountSize As Long = objAccount.Size() * 1048576 + Dim diskspace As New ServiceProviderItemDiskSpace() + diskspace.ItemId = item.Id + diskspace.DiskSpace = objAccountSize + itemsDiskspace.Add(diskspace) + Catch ex As Exception + Log.WriteError("Error calculating disk space for mail account: " + item.Name, ex) + End Try + End If + Next item + Return itemsDiskspace.ToArray() + End Function + + Public Overrides Function GetServiceItemsBandwidth(ByVal items() As ServiceProviderItem, ByVal since As Date) As ServiceProviderItemBandwidth() + Dim itemsBandwidth(items.Length) As ServiceProviderItemBandwidth + Dim objSets As Service = GetSettingsObject() + If objSets.ComObject.Logging.AWStatsEnabled Then + Dim logsPath As String = objSets.ComObject.Logging.CurrentAwstatsLog() + + For i As Integer = 0 To items.Length - 1 + Dim item As ServiceProviderItem = items(i) + + itemsBandwidth(i) = New ServiceProviderItemBandwidth() + itemsBandwidth(i).ItemId = item.Id + itemsBandwidth(i).Days = New DailyStatistics(0) {} + + If TypeOf item Is MailDomain Then + Try + itemsBandwidth(i).Days = GetDailyStatistics(since, item.Name, logsPath) + Catch ex As Exception + Log.WriteError("Error calculating bandwidth for mail domain: " + item.Name, ex) + End Try + End If + Next i + End If + Return itemsBandwidth + End Function +#End Region + Public Overrides Function IsInstalled() As Boolean Dim displayName As String = "" Dim version As String = "" @@ -93,5 +1354,4 @@ Public Class hMailServer5 End If End Function - -End Class +End Class \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.hMailServer/hMailServer.vb b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.hMailServer/hMailServer.vb index 3bc45f4b..fb0a85fc 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.hMailServer/hMailServer.vb +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.hMailServer/hMailServer.vb @@ -109,25 +109,11 @@ Public Class hMailServer objDomain.ComObject = hMailServer.Utilities objDomain.Succeed = True Catch ex As Exception - Log.WriteError("Couldn't create hMailServer.Application Utilities ActiveX object.", ex) + Log.WriteError("Couldn't create hMailServer.Application ActiveX object.", ex) End Try Return objDomain - End Function - - Private Function GetSettingsObject() As Service - Dim objSettings As New Service() - objSettings.Succeed = False - - Try - objSettings.ComObject = hMailServer.Settings - objSettings.Succeed = True - Catch ex As Exception - Log.WriteError("Couldn't create hMailServer.Application Settings ActiveX object.", ex) - End Try - - Return objSettings - End Function + End Function Private Function GetDomainObject(ByVal domainName As String) As Service ' find existing domain @@ -138,7 +124,7 @@ Public Class hMailServer objDomain.ComObject = hMailServer.Domains.ItemByName(domainName) objDomain.Succeed = True Catch ex As Exception - Log.WriteError("Couldn't create hMailServer.Application Domain ActiveX object.", ex) + Log.WriteError("Couldn't create hMailServer.Application ActiveX object.", ex) End Try Return objDomain @@ -153,7 +139,7 @@ Public Class hMailServer objDomain.ComObject = hMailServer.Domains objDomain.Succeed = True Catch ex As Exception - Log.WriteError("Couldn't create hMailServer.Application Domains ActiveX object.", ex) + Log.WriteError("Couldn't create hMailServer.Application ActiveX object.", ex) End Try Return objDomain @@ -299,26 +285,19 @@ Public Class hMailServer If mailbox.ResponderEnabled Then objAccount.VacationMessageIsOn = True objAccount.VacationSubject = mailbox.ResponderSubject - objAccount.VacationMessage = mailbox.ResponderMessage - objAccount.VacationMessageExpires = False - If mailbox.ResponderExpires Then - If IsDate(mailbox.ResponderExpirationDate) Then - objAccount.VacationMessageExpires = True - objAccount.VacationMessageExpiresDate = mailbox.ResponderExpirationDate.Substring(0, 10) - End If - End If - End If + objAccount.VacationMessage = mailbox.ResponderMessage + End If 'set forwarding address - If mailbox.ForwardingEnabled Then - objAccount.ForwardAddress = mailbox.ForwardingAddresses(0) - objAccount.ForwardEnabled = True - objAccount.ForwardKeepOriginal = mailbox.RetainLocalCopy - End If + If mailbox.ForwardingAddresses.Length > 0 Then + objAccount.ForwardAddress = mailbox.ForwardingAddresses(0) + objAccount.ForwardEnabled = True + objAccount.ForwardKeepOriginal = mailbox.RetainLocalCopy + End If objAccount.Save() - ' set account rules + ' set account rules SetAccountRules(mailbox, objAccount) @@ -343,43 +322,43 @@ Public Class hMailServer ' delete rule objAccount.Rules.DeleteByDBID(objRule.ID) End If - '// Removed to use built-in forwarding: - 'If Not mailbox.ForwardingAddresses Is Nothing _ - ' And mailbox.ForwardingAddresses.Length > 0 Then - ' ' create rule - ' ' add "default" rule - ' objRule = objAccount.Rules.Add() - ' objRule.AccountID = objAccount.ID - ' objRule.Active = True - ' objRule.Name = WEBSITEPANEL_RULE_NAME - ' objRule.Save() + If Not mailbox.ForwardingAddresses Is Nothing _ + And mailbox.ForwardingAddresses.Length > 0 Then + ' create rule - ' ' Add criteria - ' Dim objCriteria As Object = objRule.Criterias.Add() - ' objCriteria.RuleID = objRule.ID - ' objCriteria.PredefinedField = 6 ' hMailServer.eRulePredefinedField.eFTMessageSize - ' objCriteria.MatchType = 4 ' hMailServer.eRuleMatchType.eMTGreaterThan - ' objCriteria.MatchValue = "0" - ' objCriteria.Save() + ' add "default" rule + objRule = objAccount.Rules.Add() + objRule.AccountID = objAccount.ID + objRule.Active = True + objRule.Name = WEBSITEPANEL_RULE_NAME + objRule.Save() - ' ' add forwarding addresses - ' Dim forwarding As String - ' For Each forwarding In mailbox.ForwardingAddresses - ' Dim objRuleAction As Object = objRule.Actions.Add() - ' objRuleAction.RuleID = objRule.ID - ' objRuleAction.Type = 2 'eRAForwardEmail - ' objRuleAction.To = forwarding - ' objRuleAction.Save() - ' Next + ' Add criteria + Dim objCriteria As Object = objRule.Criterias.Add() + objCriteria.RuleID = objRule.ID + objCriteria.PredefinedField = 6 ' hMailServer.eRulePredefinedField.eFTMessageSize + objCriteria.MatchType = 4 ' hMailServer.eRuleMatchType.eMTGreaterThan + objCriteria.MatchValue = "0" + objCriteria.Save() - ' If mailbox.DeleteOnForward Then - ' Dim objRuleAction As Object = objRule.Actions.Add() - ' objRuleAction.RuleID = objRule.ID - ' objRuleAction.RuleID = 1 'eRADeleteEmail - ' objRuleAction.Save() - ' End If - 'End If + ' add forwarding addresses + Dim forwarding As String + For Each forwarding In mailbox.ForwardingAddresses + Dim objRuleAction As Object = objRule.Actions.Add() + objRuleAction.RuleID = objRule.ID + objRuleAction.Type = 2 'eRAForwardEmail + objRuleAction.To = forwarding + objRuleAction.Save() + Next + + If mailbox.DeleteOnForward Then + Dim objRuleAction As Object = objRule.Actions.Add() + objRuleAction.RuleID = objRule.ID + objRuleAction.RuleID = 1 'eRADeleteEmail + objRuleAction.Save() + End If + End If End Sub Public Sub CreateDomain(ByVal domain As MailDomain) Implements IMailServer.CreateDomain @@ -764,19 +743,11 @@ Public Class hMailServer account.LastName = objAccount.PersonLastName account.Enabled = objAccount.Active account.MaxMailboxSize = objAccount.MaxSize - account.Password = objAccount.Password - account.Size = objAccount.Size() - account.QuotaUsed = objAccount.QuotaUsed() - account.LastLogonTime = CType(objAccount.LastLogonTime(), DateTime) - 'auto-responder - account.ResponderEnabled = objAccount.VacationMessageIsOn + account.Password = objAccount.Password + account.ResponderEnabled = objAccount.VacationMessageIsOn account.ResponderSubject = objAccount.VacationSubject - account.ResponderMessage = objAccount.VacationMessage - account.ResponderExpires = objAccount.VacationMessageExpires - account.ResponderExpirationDate = objAccount.VacationMessageExpiresDate - 'forwarding - account.ForwardingEnabled = objAccount.ForwardEnabled - Dim forwardings As List(Of String) = New List(Of String) + account.ResponderMessage = objAccount.VacationMessage + Dim forwardings As List(Of String) = New List(Of String) forwardings.Add(objAccount.ForwardAddress) account.ForwardingAddresses = forwardings.ToArray account.RetainLocalCopy = objAccount.ForwardKeepOriginal @@ -822,32 +793,24 @@ Public Class hMailServer End If ' get account details - Dim account As MailAccount = New MailAccount() - account.Name = objAccount.Address - account.FirstName = objAccount.PersonFirstName - account.LastName = objAccount.PersonLastName - account.Enabled = objAccount.Active - account.MaxMailboxSize = objAccount.MaxSize - account.Password = objAccount.Password - account.Size = objAccount.Size() - account.QuotaUsed = objAccount.QuotaUsed() - account.LastLogonTime = CType(objAccount.LastLogonTime(), DateTime) - 'auto-responder - account.ResponderEnabled = objAccount.VacationMessageIsOn - account.ResponderSubject = objAccount.VacationSubject - account.ResponderMessage = objAccount.VacationMessage - account.ResponderExpires = objAccount.VacationMessageExpires - account.ResponderExpirationDate = objAccount.VacationMessageExpiresDate - 'forwarding - account.ForwardingEnabled = objAccount.ForwardEnabled - Dim forwardings As List(Of String) = New List(Of String) - forwardings.Add(objAccount.ForwardAddress) - account.ForwardingAddresses = forwardings.ToArray - account.RetainLocalCopy = objAccount.ForwardKeepOriginal - 'Signature - account.SignatureEnabled = objAccount.SignatureEnabled - account.Signature = objAccount.SignaturePlainText - account.SignatureHTML = objAccount.SignatureHTML + Dim account As MailAccount = New MailAccount() + account.Name = objAccount.Address + account.FirstName = objAccount.PersonFirstName + account.LastName = objAccount.PersonLastName + account.Enabled = objAccount.Active + account.MaxMailboxSize = objAccount.MaxSize + account.Password = objAccount.Password + account.ResponderEnabled = objAccount.VacationMessageIsOn + account.ResponderSubject = objAccount.VacationSubject + account.ResponderMessage = objAccount.VacationMessage + Dim forwardings As List(Of String) = New List(Of String) + forwardings.Add(objAccount.ForwardAddress) + account.ForwardingAddresses = forwardings.ToArray + account.RetainLocalCopy = objAccount.ForwardKeepOriginal + 'Signature + account.SignatureEnabled = objAccount.SignatureEnabled + account.Signature = objAccount.SignaturePlainText + account.SignatureHTML = objAccount.SignatureHTML accounts.Add(account) Next End If @@ -1012,42 +975,31 @@ Public Class hMailServer objAccount.Active = mailbox.Enabled objAccount.Password = mailbox.Password objAccount.MaxSize = mailbox.MaxMailboxSize - 'Auto-Responder - objAccount.VacationMessageIsOn = mailbox.ResponderEnabled + objAccount.VacationMessageIsOn = mailbox.ResponderEnabled objAccount.VacationSubject = mailbox.ResponderSubject - objAccount.VacationMessage = mailbox.ResponderMessage - objAccount.VacationMessageExpires = False - If mailbox.ResponderExpires Then - If IsDate(mailbox.ResponderExpirationDate) Then - objAccount.VacationMessageExpires = True - objAccount.VacationMessageExpiresDate = mailbox.ResponderExpirationDate.Substring(0, 10) - End If - End If - 'Personal Information - objAccount.PersonFirstName = mailbox.FirstName - objAccount.PersonLastName = mailbox.LastName - 'Signature - objAccount.SignatureEnabled = mailbox.SignatureEnabled - objAccount.SignaturePlainText = mailbox.Signature - objAccount.SignatureHTML = mailbox.SignatureHTML - 'Forwarding - If mailbox.ForwardingEnabled Then - If mailbox.ForwardingAddresses.Length > 0 Then - objAccount.ForwardAddress = mailbox.ForwardingAddresses(0) - objAccount.ForwardKeepOriginal = mailbox.RetainLocalCopy - objAccount.ForwardEnabled = True - End If - Else - objAccount.ForwardEnabled = False - End If - objAccount.Save() + objAccount.VacationMessage = mailbox.ResponderMessage + 'Personal Information + objAccount.PersonFirstName = mailbox.FirstName + objAccount.PersonLastName = mailbox.LastName + 'Signature + objAccount.SignatureEnabled = mailbox.SignatureEnabled + objAccount.SignaturePlainText = mailbox.Signature + objAccount.SignatureHTML = mailbox.SignatureHTML - ' set account rules - SetAccountRules(mailbox, objAccount) + If mailbox.ForwardingAddresses.Length > 0 Then + objAccount.ForwardAddress = mailbox.ForwardingAddresses(0) + objAccount.ForwardKeepOriginal = mailbox.RetainLocalCopy + objAccount.ForwardEnabled = True + End If - Catch ex As Exception - Log.WriteError("Couldn't update an account.", ex) - End Try + objAccount.Save() + + ' set account rules + SetAccountRules(mailbox, objAccount) + + Catch ex As Exception + Log.WriteError("Couldn't update an account.", ex) + End Try End If End Sub @@ -1217,119 +1169,7 @@ Public Class hMailServer End Try End If Next - End Sub - - Public Overrides Function GetServiceItemsDiskSpace(ByVal items() As ServiceProviderItem) As ServiceProviderItemDiskSpace() - Dim itemsDiskspace As List(Of ServiceProviderItemDiskSpace) = New List(Of ServiceProviderItemDiskSpace) - Dim item As ServiceProviderItem - For Each item In items - If TypeOf item Is MailAccount Then - Try - Dim objDomain As Service = GetDomainObject(GetDomainName(item.Name)) - Dim objAccount = objDomain.ComObject.Accounts.ItemByAddress(item.Name) - Dim objAccountSize As Long = objAccount.Size() * 1048576 - Dim diskspace As New ServiceProviderItemDiskSpace() - diskspace.ItemId = item.Id - diskspace.DiskSpace = objAccountSize - itemsDiskspace.Add(diskspace) - Catch ex As Exception - Log.WriteError("Error calculating disk space for mail account: " + item.Name, ex) - End Try - End If - Next item - Return itemsDiskspace.ToArray() - End Function - - Public Overrides Function GetServiceItemsBandwidth(ByVal items() As ServiceProviderItem, ByVal since As Date) As ServiceProviderItemBandwidth() - Dim itemsBandwidth(items.Length) As ServiceProviderItemBandwidth - Dim objSets As Service = GetSettingsObject() - If objSets.ComObject.Logging.AWStatsEnabled Then - Dim logsPath As String = objSets.ComObject.Logging.CurrentAwstatsLog() - - Dim i As Integer - For i = 0 To items.Length - 1 - Dim item As ServiceProviderItem = items(i) - - itemsBandwidth(i) = New ServiceProviderItemBandwidth() - itemsBandwidth(i).ItemId = item.Id - itemsBandwidth(i).Days = New DailyStatistics(0) {} - - If TypeOf item Is MailDomain Then - Try - itemsBandwidth(i).Days = GetDailyStatistics(since, item.Name, logsPath) - Catch ex As Exception - Log.WriteError("Error calculating bandwidth for mail domain: " + item.Name, ex) - End Try - End If - Next i - End If - Return itemsBandwidth - End Function - - Private Function GetDailyStatistics(ByVal since As DateTime, ByVal mailDomainName As String, ByVal logpath As String) As DailyStatistics() - Dim days As New ArrayList() - Dim now As DateTime = DateTime.Now - Dim [date] As DateTime = since - Dim mailDomainBytesReceived As Long = 0 - Dim mailDomainBytesSent As Long = 0 - - Try - While [date] < now - If File.Exists(logpath) Then - - Using r As StreamReader = New StreamReader(logpath) - Dim line As String - ' Read first line. - line = r.ReadLine - - Do While (Not line Is Nothing) - Dim vals As String() = line.Split(vbTab) - If vals.Length = 9 Then - Dim logDate As DateTime = CType(vals(0), DateTime) - If logDate >= [date] Then - 'get sent bytes - If InStr(vals(1), mailDomainName) Then - mailDomainBytesSent += Int32.Parse(vals(8)) - End If - - 'get received bytes - If InStr(vals(2), mailDomainName) Then - mailDomainBytesReceived += Int32.Parse(vals(8)) - End If - End If - If logDate.Date > [date].Date Then - Exit Do - End If - - End If - - line = r.ReadLine - - Loop - End Using - End If - - If mailDomainBytesReceived <> 0 Or mailDomainBytesSent <> 0 Then - Dim dailyStats As New DailyStatistics() - dailyStats.Year = [date].Year - dailyStats.Month = [date].Month - dailyStats.Day = [date].Day - dailyStats.BytesSent = mailDomainBytesSent - dailyStats.BytesReceived = mailDomainBytesReceived - days.Add(dailyStats) - End If - - ' advance day - [date] = [date].AddDays(1) - mailDomainBytesReceived = 0 - mailDomainBytesSent = 0 - End While - Catch ex As Exception - Log.WriteError("Could't parse hMailServer Log", ex) - End Try - Return DirectCast(days.ToArray(GetType(DailyStatistics)), DailyStatistics()) - End Function - + End Sub Public Overrides Sub DeleteServiceItems(ByVal items() As ServiceProviderItem) For Each item As ServiceProviderItem In items diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer43_EditAccount.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer43_EditAccount.ascx.resx index cb9887d3..23eb4074 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer43_EditAccount.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer43_EditAccount.ascx.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Yes @@ -165,37 +165,4 @@ Signature - - Yes - - - Yes - - - Yes - - - Mailbox Enabled: - - - Forwarding Enabled: - - - Last Login Date: - - - Quota Used: - - - Autoresponder Expire Date: - - - Autoresponder Expires: - - - Current Size: - - - Account Information - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditAccount.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditAccount.ascx.resx new file mode 100644 index 00000000..cb9887d3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditAccount.ascx.resx @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Yes + + + Keep original Message + + + First Name: + + + Forward mail to address: + + + HTML Signature + + + Last Name: + + + Message: + + + Plain Text Signature + + + Reply to address: + + + Autoresponder Enabled: + + + Signature Enabled: + + + Subject: + + + Autoresponder + + + Mail Forwarding + + + Personal Information + + + Signature + + + Yes + + + Yes + + + Yes + + + Mailbox Enabled: + + + Forwarding Enabled: + + + Last Login Date: + + + Quota Used: + + + Autoresponder Expire Date: + + + Autoresponder Expires: + + + Current Size: + + + Account Information + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditDomain.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditDomain.ascx.resx new file mode 100644 index 00000000..1db5fcef --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditDomain.ascx.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Abuse Account: + + + Catch-All Account: + + + Postmaster Account: + + + <Not Selected> + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditGroup.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditGroup.ascx.resx new file mode 100644 index 00000000..3917aca2 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditGroup.ascx.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Group E-Mails: + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditList.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditList.ascx.resx new file mode 100644 index 00000000..702532c9 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_EditList.ascx.resx @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Announcements + + + Membership + + + Password Protected Posting + + + Public + + + Announcements E-mail: + + + Mailing List Members: + + + Posting Mode: + + + Require SMTP Authentication + + + Security + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_Settings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_Settings.ascx.resx new file mode 100644 index 00000000..1bd942e1 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/hMailServer5_Settings.ascx.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Admin Login: + + + Admin Password: + + + Current Admin Password: + + + Public IP Address: + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer43_EditAccount.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer43_EditAccount.ascx index 43be89f2..54462ec4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer43_EditAccount.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer43_EditAccount.ascx @@ -1,45 +1,6 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="hMailServer43_EditAccount.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.hMailServer43_EditAccount" %> <%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> - - - - - - - - - - - - - - - - - - - - - -
- -
- - - -
- - - -
- - - -
-
- @@ -47,15 +8,15 @@ - - -
+ +
+ @@ -72,35 +33,23 @@ - - + - + - + - - - - - - - -
+
- -
- -
@@ -110,19 +59,13 @@ - - - - - - + -
- -
+
+ = 10) { - item.ResponderExpirationDate = txtResponderExireDate.Text.Trim().Substring(0, 10);} - item.ForwardingEnabled = chkForwardingEnabled.Checked; - if (txtForward.Text.Trim().Length > 0) { - item.ForwardingAddresses = new string[] { txtForward.Text.Trim() };} + if (txtForward.Text.Length > 0) + { + item.ForwardingAddresses = new string[] { txtForward.Text }; + } item.RetainLocalCopy = chkOriginalMessage.Checked; item.FirstName = txtFirstName.Text; item.LastName = txtLastName.Text; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer43_EditAccount.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer43_EditAccount.ascx.designer.cs index a5bb873e..77b5a1b8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer43_EditAccount.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer43_EditAccount.ascx.designer.cs @@ -3,7 +3,7 @@ // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -12,96 +12,6 @@ namespace WebsitePanel.Portal.ProviderControls { public partial class hMailServer43_EditAccount { - /// - /// secStatusInfo control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.CollapsiblePanel secStatusInfo; - - /// - /// StatusInfoPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel StatusInfoPanel; - - /// - /// lblEnabled control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblEnabled; - - /// - /// chkEnabled control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.CheckBox chkEnabled; - - /// - /// lblSize control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSize; - - /// - /// lblSizeInfo control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSizeInfo; - - /// - /// lblQuotaUsed control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblQuotaUsed; - - /// - /// lblQuotaUsedInfo control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblQuotaUsedInfo; - - /// - /// lblLastLoginDate control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblLastLoginDate; - - /// - /// lblLastLoginDateInfo control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblLastLoginDateInfo; - /// /// secPersonalInfo control. /// @@ -228,42 +138,6 @@ namespace WebsitePanel.Portal.ProviderControls { /// protected global::System.Web.UI.WebControls.TextBox txtMessage; - /// - /// lblResponderExpires control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblResponderExpires; - - /// - /// chkResponderExpires control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.CheckBox chkResponderExpires; - - /// - /// lblResponderExpireDate control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblResponderExpireDate; - - /// - /// txtResponderExireDate control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtResponderExireDate; - /// /// secForwarding control. /// @@ -282,24 +156,6 @@ namespace WebsitePanel.Portal.ProviderControls { /// protected global::System.Web.UI.WebControls.Panel ForwardingPanel; - /// - /// lblForwardingEnabled control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblForwardingEnabled; - - /// - /// chkForwardingEnabled control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.CheckBox chkForwardingEnabled; - /// /// lblForwardTo control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditAccount.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditAccount.ascx new file mode 100644 index 00000000..631ed3a1 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditAccount.ascx @@ -0,0 +1,177 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="hMailServer5_EditAccount.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.hMailServer5_EditAccount" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + 0 +
+ + + 0 +
+ + + n/a +
+
+ + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + +
+ +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
 
+ +
+ + +
+ +
+ + +
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditAccount.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditAccount.ascx.cs new file mode 100644 index 00000000..93abaa53 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditAccount.ascx.cs @@ -0,0 +1,93 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.Providers.Mail; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class hMailServer5_EditAccount : WebsitePanelControlBase, IMailEditAccountControl + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + public void BindItem(MailAccount item) + { + chkEnabled.Checked = item.Enabled; + lblSizeInfo.Text = item.Size.ToString() + " MB"; + lblQuotaUsedInfo.Text = item.QuotaUsed.ToString() + " %"; + lblLastLoginDateInfo.Text = item.LastLogonTime; + chkResponderEnabled.Checked = item.ResponderEnabled; + chkResponderExpires.Checked = item.ResponderExpires; + txtResponderExireDate.Text = item.ResponderExpirationDate; + txtSubject.Text = item.ResponderSubject; + txtMessage.Text = item.ResponderMessage; + chkForwardingEnabled.Checked = item.ForwardingEnabled; + txtForward.Text = item.ForwardingAddresses[0]; + chkOriginalMessage.Checked = item.RetainLocalCopy; + txtFirstName.Text = item.FirstName; + txtLastName.Text = item.LastName; + cbSignatureEnabled.Checked = item.SignatureEnabled; + txtPlainSignature.Text = item.Signature; + txtHtmlSignature.Text = item.SignatureHTML; + secStatusInfo.IsCollapsed = false; + } + + public void SaveItem(MailAccount item) + { + item.Enabled = chkEnabled.Checked; + item.ResponderEnabled = chkResponderEnabled.Checked; + item.ResponderSubject = txtSubject.Text; + item.ResponderMessage = txtMessage.Text; + item.ResponderExpires = chkResponderExpires.Checked; + if (txtResponderExireDate.Text.Trim().Length >= 10) { + item.ResponderExpirationDate = txtResponderExireDate.Text.Trim().Substring(0, 10);} + item.ForwardingEnabled = chkForwardingEnabled.Checked; + if (txtForward.Text.Trim().Length > 0) { + item.ForwardingAddresses = new string[] { txtForward.Text.Trim() };} + item.RetainLocalCopy = chkOriginalMessage.Checked; + item.FirstName = txtFirstName.Text; + item.LastName = txtLastName.Text; + item.SignatureEnabled = cbSignatureEnabled.Checked; + item.Signature = txtPlainSignature.Text; + item.SignatureHTML = txtHtmlSignature.Text; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditAccount.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditAccount.ascx.designer.cs new file mode 100644 index 00000000..bcb1c61d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditAccount.ascx.designer.cs @@ -0,0 +1,402 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class hMailServer5_EditAccount { + + /// + /// secStatusInfo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secStatusInfo; + + /// + /// StatusInfoPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel StatusInfoPanel; + + /// + /// lblEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblEnabled; + + /// + /// chkEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnabled; + + /// + /// lblSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSize; + + /// + /// lblSizeInfo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSizeInfo; + + /// + /// lblQuotaUsed control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblQuotaUsed; + + /// + /// lblQuotaUsedInfo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblQuotaUsedInfo; + + /// + /// lblLastLoginDate control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblLastLoginDate; + + /// + /// lblLastLoginDateInfo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblLastLoginDateInfo; + + /// + /// secPersonalInfo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPersonalInfo; + + /// + /// PersonalInfoPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel PersonalInfoPanel; + + /// + /// lblFirstName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblFirstName; + + /// + /// txtFirstName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtFirstName; + + /// + /// lblLastName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblLastName; + + /// + /// txtLastName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtLastName; + + /// + /// secAutoresponder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secAutoresponder; + + /// + /// AutoresponderPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel AutoresponderPanel; + + /// + /// lblResponderEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblResponderEnabled; + + /// + /// chkResponderEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkResponderEnabled; + + /// + /// lblSubject control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSubject; + + /// + /// txtSubject control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSubject; + + /// + /// lblMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMessage; + + /// + /// txtMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMessage; + + /// + /// lblResponderExpires control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblResponderExpires; + + /// + /// chkResponderExpires control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkResponderExpires; + + /// + /// lblResponderExpireDate control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblResponderExpireDate; + + /// + /// txtResponderExireDate control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtResponderExireDate; + + /// + /// secForwarding control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secForwarding; + + /// + /// ForwardingPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel ForwardingPanel; + + /// + /// lblForwardingEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblForwardingEnabled; + + /// + /// chkForwardingEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkForwardingEnabled; + + /// + /// lblForwardTo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblForwardTo; + + /// + /// txtForward control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtForward; + + /// + /// chkOriginalMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkOriginalMessage; + + /// + /// Signature control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel Signature; + + /// + /// SignaturePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SignaturePanel; + + /// + /// lblSignatureEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSignatureEnabled; + + /// + /// cbSignatureEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbSignatureEnabled; + + /// + /// lblPlainSignature control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblPlainSignature; + + /// + /// txtPlainSignature control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPlainSignature; + + /// + /// lblHtmlSignature control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblHtmlSignature; + + /// + /// txtHtmlSignature control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtHtmlSignature; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditDomain.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditDomain.ascx new file mode 100644 index 00000000..3d26c184 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditDomain.ascx @@ -0,0 +1,9 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="hMailServer5_EditDomain.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.hMailServer5_EditDomain" %> + + + + + +
+ +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditDomain.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditDomain.ascx.cs new file mode 100644 index 00000000..718ceece --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditDomain.ascx.cs @@ -0,0 +1,87 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.Providers.Mail; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class hMailServer5_EditDomain : WebsitePanelControlBase, IMailEditDomainControl + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + public void BindItem(MailDomain item) + { + BindMailboxes(item); + } + + public void SaveItem(MailDomain item) + { + item.CatchAllAccount = ddlCatchAllAccount.SelectedValue; + } + + private void BindMailboxes(MailDomain item) + { + MailAccount[] accounts = ES.Services.MailServers.GetMailAccounts(item.PackageId, false); + MailAlias[] forwardings = ES.Services.MailServers.GetMailForwardings(item.PackageId, false); + + BindAccounts(item, ddlCatchAllAccount, accounts); + BindAccounts(item, ddlCatchAllAccount, forwardings); + Utils.SelectListItem(ddlCatchAllAccount, item.CatchAllAccount); + } + + private void BindAccounts(MailDomain item, DropDownList ddl, MailAccount[] accounts) + { + if (ddl.Items.Count == 0) + ddl.Items.Add(new ListItem(GetLocalizedString("Text.NotSelected"), "")); + + foreach (MailAccount account in accounts) + { + int idx = account.Name.IndexOf("@"); + string accountName = account.Name.Substring(0, idx); + string accountDomain = account.Name.Substring(idx + 1); + + if (String.Compare(accountDomain, item.Name, true) == 0) + ddl.Items.Add(new ListItem(account.Name, accountName)); + } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditDomain.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditDomain.ascx.designer.cs new file mode 100644 index 00000000..a23a959c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditDomain.ascx.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class hMailServer5_EditDomain { + + /// + /// lblCatchAll control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblCatchAll; + + /// + /// ddlCatchAllAccount control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlCatchAllAccount; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditForwarding.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditForwarding.ascx new file mode 100644 index 00000000..cebb8ce9 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditForwarding.ascx @@ -0,0 +1 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="hMailServer5_EditForwarding.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.hMailServer5_EditForwarding" %> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditForwarding.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditForwarding.ascx.cs new file mode 100644 index 00000000..b0fb0fce --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditForwarding.ascx.cs @@ -0,0 +1,60 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.Providers.Mail; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class hMailServer5_EditForwarding : WebsitePanelControlBase, IMailEditForwardingControl + { + protected void Page_Load(object sender, EventArgs e) + { + } + + public void BindItem(MailAlias item) + { + + } + + public void SaveItem(MailAlias item) + { + + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditForwarding.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditForwarding.ascx.designer.cs new file mode 100644 index 00000000..77df182a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditForwarding.ascx.designer.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class hMailServer5_EditForwarding { + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditGroup.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditGroup.ascx new file mode 100644 index 00000000..b391d30b --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditGroup.ascx @@ -0,0 +1,12 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="hMailServer5_EditGroup.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.hMailServer5_EditGroup" %> +<%@ Register TagPrefix="dnc" TagName="EditItemsList" Src="../MailEditItems.ascx" %> + + + + + +
+ + + +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditGroup.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditGroup.ascx.cs new file mode 100644 index 00000000..4abaf3ff --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditGroup.ascx.cs @@ -0,0 +1,60 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.Providers.Mail; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class hMailServer5_EditGroup : WebsitePanelControlBase, IMailEditGroupControl + { + protected void Page_Load(object sender, EventArgs e) + { + } + + public void BindItem(MailGroup item) + { + mailEditItems.Items = item.Members; + } + + public void SaveItem(MailGroup item) + { + item.Members = mailEditItems.Items; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditGroup.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditGroup.ascx.designer.cs new file mode 100644 index 00000000..844d1a57 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditGroup.ascx.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class hMailServer5_EditGroup { + + /// + /// lblGroupMembers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblGroupMembers; + + /// + /// mailEditItems control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.MailEditItems mailEditItems; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditList.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditList.ascx new file mode 100644 index 00000000..438262d9 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditList.ascx @@ -0,0 +1,48 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="hMailServer5_EditList.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.hMailServer5_EditList" %> +<%@ Register TagPrefix="dnc" TagName="EditItemsList" Src="../MailEditItems.ascx" %> +<%@ Register Src="../UserControls/EmailControl.ascx" TagName="EmailControl" TagPrefix="uc2" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> + + + + + + + + + + + + + + + + + + + + +
  
+ + + + MemberShip + Public + Announcements + +
+ + + + +
 
+ + + +
+ + + + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditList.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditList.ascx.cs new file mode 100644 index 00000000..eb5a2091 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditList.ascx.cs @@ -0,0 +1,77 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.Providers.Mail; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class hMailServer5_EditList : WebsitePanelControlBase, IMailEditListControl + { + protected void Page_Load(object sender, EventArgs e) + { + } + + public void BindItem(MailList item) + { + Utils.SelectListItem(ddlPostingMode, item.PostingMode); + mailEditItems.Items = item.Members; + txtEmailAnnouncements.Text = item.ModeratorAddress; + cbSMTPAuthentication.Checked = item.RequireSmtpAuthentication; + ToggleFormControls(); + } + + public void SaveItem(MailList item) + { + item.PostingMode = (PostingMode)Enum.Parse(typeof(PostingMode), ddlPostingMode.SelectedValue, true); + item.ModeratorAddress = txtEmailAnnouncements.Text; + item.Members = mailEditItems.Items; + item.RequireSmtpAuthentication = cbSMTPAuthentication.Checked; + } + + protected void ddlPostingMode_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleFormControls(); + } + + private void ToggleFormControls() + { + lblEmail.Visible = txtEmailAnnouncements.Visible = (ddlPostingMode.SelectedValue == "ModeratorCanPost"); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditList.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditList.ascx.designer.cs new file mode 100644 index 00000000..0de271ff --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_EditList.ascx.designer.cs @@ -0,0 +1,105 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class hMailServer5_EditList { + + /// + /// lblPostingMode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblPostingMode; + + /// + /// ddlPostingMode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlPostingMode; + + /// + /// lblEmail control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblEmail; + + /// + /// txtEmailAnnouncements control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EmailControl txtEmailAnnouncements; + + /// + /// lblMembers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMembers; + + /// + /// mailEditItems control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.MailEditItems mailEditItems; + + /// + /// Security control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel Security; + + /// + /// pSecurity control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel pSecurity; + + /// + /// cbSMTPAuthentication control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbSMTPAuthentication; + + /// + /// Label1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label Label1; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_Settings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_Settings.ascx new file mode 100644 index 00000000..3f15ae2f --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_Settings.ascx @@ -0,0 +1,35 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="hMailServer5_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.hMailServer5_Settings" %> +<%@ Register Src="../UserControls/SelectIPAddress.ascx" TagName="SelectIPAddress" TagPrefix="uc1" %> + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + ******* +
+ + + +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_Settings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_Settings.ascx.cs new file mode 100644 index 00000000..0099c0df --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_Settings.ascx.cs @@ -0,0 +1,64 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Collections.Specialized; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class hMailServer5_Settings : WebsitePanelControlBase, IHostingServiceProviderSettings + { + protected void Page_Load(object sender, EventArgs e) + { + } + + public void BindSettings(StringDictionary settings) + { + ipAddress.AddressId = (settings["ServerIpAddress"] != null) ? Utils.ParseInt(settings["ServerIpAddress"], 0) : 0; + txtUsername.Text = settings["AdminUsername"]; + ViewState["PWD"] = settings["AdminPassword"]; + rowPassword.Visible = ((string)ViewState["PWD"]) != ""; + } + + public void SaveSettings(StringDictionary settings) + { + settings["ServerIpAddress"] = ipAddress.AddressId.ToString(); + settings["AdminUsername"] = txtUsername.Text.Trim(); + settings["AdminPassword"] = (txtPassword.Text.Length > 0) ? txtPassword.Text : (string)ViewState["PWD"]; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_Settings.ascx.designer.cs new file mode 100644 index 00000000..cd273103 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/hMailServer5_Settings.ascx.designer.cs @@ -0,0 +1,87 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class hMailServer5_Settings { + + /// + /// lblPublicIP control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblPublicIP; + + /// + /// ipAddress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.SelectIPAddress ipAddress; + + /// + /// lblAdminLogin control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblAdminLogin; + + /// + /// txtUsername control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtUsername; + + /// + /// rowPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow rowPassword; + + /// + /// lblCurrPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblCurrPassword; + + /// + /// lblAdminPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblAdminPassword; + + /// + /// txtPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPassword; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index 33494c83..dda50430 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -199,6 +199,48 @@ + + hMailServer5_EditAccount.ascx + ASPXCodeBehind + + + hMailServer5_EditAccount.ascx + + + hMailServer5_EditDomain.ascx + ASPXCodeBehind + + + hMailServer5_EditDomain.ascx + + + hMailServer5_EditForwarding.ascx + ASPXCodeBehind + + + hMailServer5_EditForwarding.ascx + + + hMailServer5_EditGroup.ascx + ASPXCodeBehind + + + hMailServer5_EditGroup.ascx + + + hMailServer5_EditList.ascx + ASPXCodeBehind + + + hMailServer5_EditList.ascx + + + hMailServer5_Settings.ascx + ASPXCodeBehind + + + hMailServer5_Settings.ascx + NotifyOverusedDatabases.ascx ASPXCodeBehind @@ -3707,6 +3749,12 @@ + + + + + + @@ -4842,6 +4890,21 @@ Designer + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + Designer