From 1be972bd40d355d6fc7ed2a7c947ce9be9fc1576 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sun, 25 Jan 2015 10:17:17 +0100 Subject: [PATCH] Added test mail on changing SMTP settings --- ...ransmission.NotificationPayload.Designer.cs | 18 ++++++++++++++++++ ...tions.Transmission.NotificationPayload.resx | 6 ++++++ .../Transmission/NotificationPayload.cs | 1 + Site5/App_GlobalResources/Pages.Admin.resx | 3 +++ Site5/Pages/v5/Admin/Settings.aspx.cs | 5 +++++ 5 files changed, 33 insertions(+) diff --git a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs index d97e9ac8..869f3d6b 100644 --- a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs +++ b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs @@ -530,6 +530,24 @@ namespace Swarmops.Logic.App_GlobalResources { } } + /// + /// Looks up a localized string similar to This is a test mail sent by Swarmops [SwarmopsVersion] running on [HostName]. You just changed the mail server settings. To verify that the new settings are correct, Swarmops dispatches this test message to be sent from the back end.. + /// + internal static string System_MailServerTest_Body { + get { + return ResourceManager.GetString("System_MailServerTest_Body", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Swarmops Mail Server Test. + /// + internal static string System_MailServerTest_Subject { + get { + return ResourceManager.GetString("System_MailServerTest_Subject", resourceCulture); + } + } + /// /// Looks up a localized string similar to Swarmops Backend version [SwarmopsVersion] on host [HostName] has successfully started and connected to database and notification frameworks.. /// diff --git a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx index ee07e25f..845967b9 100644 --- a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx +++ b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx @@ -313,6 +313,12 @@ This is for information only. You do not need to take action. Swarmops EXCEPTION! + + This is a test mail sent by Swarmops [SwarmopsVersion] running on [HostName]. You just changed the mail server settings. To verify that the new settings are correct, Swarmops dispatches this test message to be sent from the back end. + + + Swarmops Mail Server Test + Swarmops Backend version [SwarmopsVersion] on host [HostName] has successfully started and connected to database and notification frameworks. diff --git a/Logic/Communications/Transmission/NotificationPayload.cs b/Logic/Communications/Transmission/NotificationPayload.cs index 8500de9a..a9837bd1 100644 --- a/Logic/Communications/Transmission/NotificationPayload.cs +++ b/Logic/Communications/Transmission/NotificationPayload.cs @@ -100,6 +100,7 @@ namespace Swarmops.Logic.Communications.Transmission System_Startup, System_Exception, System_DatabaseSchemaUpgraded, + System_MailServerTest, CashAdvance_Requested, CashAdvance_Attested, CashAdvance_Deattested, diff --git a/Site5/App_GlobalResources/Pages.Admin.resx b/Site5/App_GlobalResources/Pages.Admin.resx index fb6a345b..70215f8f 100644 --- a/Site5/App_GlobalResources/Pages.Admin.resx +++ b/Site5/App_GlobalResources/Pages.Admin.resx @@ -206,4 +206,7 @@ SMTP Server (user:pass@host:port) + + Swarmops has sent you a test mail to verify your new SMTP server settings. + \ No newline at end of file diff --git a/Site5/Pages/v5/Admin/Settings.aspx.cs b/Site5/Pages/v5/Admin/Settings.aspx.cs index a9750a40..4bd5e5f2 100644 --- a/Site5/Pages/v5/Admin/Settings.aspx.cs +++ b/Site5/Pages/v5/Admin/Settings.aspx.cs @@ -11,6 +11,8 @@ using System.Globalization; using System.Web.Services; using System.Text.RegularExpressions; using Swarmops.Frontend.Controls.v5.Base; +using Swarmops.Logic.Communications; +using Swarmops.Logic.Structure; namespace Swarmops.Frontend.Pages.v5.Admin { @@ -98,8 +100,11 @@ namespace Swarmops.Frontend.Pages.v5.Admin SystemSettings.SmtpHost = host; SystemSettings.SmtpPort = port; + OutboundComm.CreateNotification(Organization.Sandbox, Logic.Communications.Transmission.NotificationResource.System_MailServerTest); + result.ResultCode = AjaxTextBox.CodeChanged; result.NewData = FormatSmtpAccessString (user, pass, host, port); + result.DisplayMessage = Resources.Pages.Admin.SystemSettings_TestMailSent; } else {