From 87c3dac718e8716733bd8e515b2c147b46641d79 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Fri, 27 Nov 2015 15:16:53 +0100 Subject: [PATCH] Added notification traceability --- Logic/Communications/Payload/NotificationPayload.cs | 6 +++++- ...ations.Transmission.NotificationPayload.Designer.cs | 10 ++++++++++ ...ommunications.Transmission.NotificationPayload.resx | 4 ++++ Utility/Communications/CommsTransmitterMail.cs | 10 ++++++++-- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Logic/Communications/Payload/NotificationPayload.cs b/Logic/Communications/Payload/NotificationPayload.cs index a550d1dc..653c399d 100644 --- a/Logic/Communications/Payload/NotificationPayload.cs +++ b/Logic/Communications/Payload/NotificationPayload.cs @@ -61,7 +61,11 @@ namespace Swarmops.Logic.Communications.Payload { return ExpandMacros ( - Logic_Communications_Transmission_NotificationPayload.ResourceManager.GetString (BodyResource, CultureInfo.CreateSpecificCulture (cultureId))); + Logic_Communications_Transmission_NotificationPayload.ResourceManager.GetString (BodyResource, + CultureInfo.CreateSpecificCulture (cultureId))) + "\r\n\r\n" + + ExpandMacros ( + Logic_Communications_Transmission_NotificationPayload.ResourceManager.GetString ( + "NotificationFooter_Generic", CultureInfo.CreateSpecificCulture (cultureId))); } public string ExpandMacros (string input) diff --git a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs index 49f97360..df7967f7 100644 --- a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs +++ b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs @@ -507,6 +507,16 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to -- + ///This mail was sent to [Addressee] from [OrganizationName]. If you do not desire to receive these notifications in the future, please log on to [InstallationName] at [ExternalUrl] and modify your notification settings.. + /// + internal static string NotificationFooter_Generic { + get { + return ResourceManager.GetString("NotificationFooter_Generic", resourceCulture); + } + } + /// /// Looks up a localized string similar to Your message has been queued for delivery and the recipients have been resolved. Your mail will be sent to, or be attempted to sent to, [RecipientCount] people in [Geography] in [OrganizationName].. /// diff --git a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx index 9c2352f2..7fb7e922 100644 --- a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx +++ b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx @@ -303,6 +303,10 @@ Please log on to [InstallationName] at [ExternalUrl]Financial/AttestCosts to att [[OrganizationName]] [Regularship] renewed: [PersonName], [PersonGeography] [CountryCode] (manual) + + -- +This mail was sent to [Addressee] from [OrganizationName]. If you do not desire to receive these notifications in the future, please log on to [InstallationName] at [ExternalUrl] and modify your notification settings. + Your message has been queued for delivery and the recipients have been resolved. Your mail will be sent to, or be attempted to sent to, [RecipientCount] people in [Geography] in [OrganizationName]. diff --git a/Utility/Communications/CommsTransmitterMail.cs b/Utility/Communications/CommsTransmitterMail.cs index fa8400be..68c2fade 100644 --- a/Utility/Communications/CommsTransmitterMail.cs +++ b/Utility/Communications/CommsTransmitterMail.cs @@ -51,8 +51,14 @@ namespace Swarmops.Utility.Communications throw new OutboundCommTransmitException ("Cannot send mail to " + person.Mail, e); } - mail.Subject = (string) comm[CommRenderPart.Subject]; - mail.Body = (string) comm[CommRenderPart.BodyText]; + string mailBodyText = (string)comm[CommRenderPart.BodyText]; + mailBodyText = mailBodyText.Replace("[Addressee]", person.Canonical); + + string mailBodyHtml = (string)comm[CommRenderPart.BodyHtml]; + mailBodyHtml = mailBodyHtml.Replace("[Addressee]", person.Canonical); + + mail.Subject = (string)comm[CommRenderPart.Subject]; + mail.Body = mailBodyText; mail.SubjectEncoding = Encoding.UTF8; mail.BodyEncoding = Encoding.UTF8;