diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index cdc83a40..3d8b2222 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/bsmd.ExcelReadService/ExcelReadService.cs b/nsw/Source/bsmd.ExcelReadService/ExcelReadService.cs index 729c0cda..0a9ae1d0 100644 --- a/nsw/Source/bsmd.ExcelReadService/ExcelReadService.cs +++ b/nsw/Source/bsmd.ExcelReadService/ExcelReadService.cs @@ -89,7 +89,7 @@ namespace bsmd.ExcelReadService bool readResult; string readMessage = ""; string receiptText = ""; - MessageCore messageCore = null; + MessageCore messageCore = null; if (attachmentLocalPath == null) @@ -133,7 +133,7 @@ namespace bsmd.ExcelReadService // Quittung / set messagecore to createreport and let reportGenerator create a reply? if (Properties.Settings.Default.SendConfirmationSheet) { - string confirmationFileName = Path.Combine(Path.GetDirectoryName(attachmentLocalPath), + string confirmationFileName = Path.Combine(Path.GetDirectoryName(attachmentLocalPath), string.Format("{0}_confirm.xls", Path.GetFileNameWithoutExtension(attachmentLocalPath))); if (reader.SaveCopy(confirmationFileName)) @@ -145,7 +145,7 @@ namespace bsmd.ExcelReadService } } } - } + } } if (receiptText.Length > 0) @@ -159,7 +159,7 @@ namespace bsmd.ExcelReadService // remove attachment _log.InfoFormat("removing local file {0}", attachmentLocalPath); - if(!Properties.Settings.Default.TestMode) + if (!Properties.Settings.Default.TestMode) File.Delete(attachmentLocalPath); } diff --git a/nsw/Source/bsmd.email/BSMDPopClient.cs b/nsw/Source/bsmd.email/BSMDPopClient.cs index 8b9c710e..3a786603 100644 --- a/nsw/Source/bsmd.email/BSMDPopClient.cs +++ b/nsw/Source/bsmd.email/BSMDPopClient.cs @@ -13,6 +13,8 @@ using System.IO; using OpenPop.Pop3; using OpenPop.Mime; using log4net; +using System.Security.Cryptography.X509Certificates; +using System.Net.Security; namespace bsmd.email { @@ -28,7 +30,10 @@ namespace bsmd.email try { this.pop3Client = new Pop3Client(); - this.pop3Client.Connect(Properties.Settings.Default.POP3Server, 995, true); + + this.pop3Client.Connect(Properties.Settings.Default.POP3Server, Properties.Settings.Default.POP3Port, true, + 60000, 60000, new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate)); + this.pop3Client.Authenticate(Properties.Settings.Default.POP3User, Properties.Settings.Default.POP3Password); this._connected = true; } @@ -39,6 +44,14 @@ namespace bsmd.email } } + /// + /// Diese Funktion validiert *jedes* Zertifikat und ist eigentlich scheiße. Das geht nur so im abgeschlossenen BSMD Netz! + /// + public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) + { + return true; + } + public bool IsConnected { get { return this._connected; } } public bool ReceiveSingleMail(out string attachmentLocalFile, out string messageId, out string sender) @@ -50,7 +63,7 @@ namespace bsmd.email if (!_connected) return false; int messageCount = this.pop3Client.GetMessageCount(); - if (messageCount > 0) + if (messageCount > (this.currentMail - 1)) { Message mailMessage = this.pop3Client.GetMessage(this.currentMail); diff --git a/nsw/Source/bsmd.email/Properties/Settings.Designer.cs b/nsw/Source/bsmd.email/Properties/Settings.Designer.cs index 8a19806a..6f6d5b5c 100644 --- a/nsw/Source/bsmd.email/Properties/Settings.Designer.cs +++ b/nsw/Source/bsmd.email/Properties/Settings.Designer.cs @@ -114,5 +114,14 @@ namespace bsmd.email.Properties { return ((string)(this["AdminEmail"])); } } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("995")] + public int POP3Port { + get { + return ((int)(this["POP3Port"])); + } + } } } diff --git a/nsw/Source/bsmd.email/Properties/Settings.settings b/nsw/Source/bsmd.email/Properties/Settings.settings index d9cd5437..0be99f7a 100644 --- a/nsw/Source/bsmd.email/Properties/Settings.settings +++ b/nsw/Source/bsmd.email/Properties/Settings.settings @@ -35,5 +35,8 @@ nsw@textbausteine.net + + 995 + \ No newline at end of file diff --git a/nsw/Source/bsmd.email/app.config b/nsw/Source/bsmd.email/app.config index 0995fee1..a1364b34 100644 --- a/nsw/Source/bsmd.email/app.config +++ b/nsw/Source/bsmd.email/app.config @@ -42,6 +42,9 @@ nsw@textbausteine.net + + 995 + \ No newline at end of file