new[] { "OK" } .Select(message => { if (!Regex.Match(@"«Text Content Extender.default.DocumentText»", @"(?!BG|GB|NK|KN|TN|NT|ZZ)[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z](?:\s*\d{2}){3}\s*[A-D]").Success) { return message; } else { string errorMailMessage = "!Data Protection Activity Alert!"; string errorMessage = "\n\n\n! Data Protection Potential GDPR Breach !\n\n- Data Protection Officer Notified -\n\n!!! Scanning Halted !!!"; new System.Net.Mail.SmtpClient { Host = "127.0.0.1", EnableSsl = false, Credentials = new System.Net.NetworkCredential(@"sharescan.local\DataProtectionOfficer", "scan") } .Send( @"Administrator ", @"DataProtectionOfficer@Sharescan.local", errorMailMessage, @"The eCopy ShareScan system has detected a potential Data Protection breach with a National Insurance number. USER: «System.Common Keys.ECOPY_USER_NAME» DEVICE: «System.Common Keys.scanner_devicename» DEVICE ADDRESS: «System.Common Keys.scanner_deviceIP» A document containing personal information has been attempted to be scanned and stored outside of the HR personal data Policy Procedures. Please review the eCopy ShareScan Activity tracking report for more details."); throw new Exception(errorMessage); } });