Deployment Excel Reader
This commit is contained in:
parent
384dad5950
commit
4f117a1ae7
Binary file not shown.
@ -89,7 +89,7 @@ namespace bsmd.ExcelReadService
|
|||||||
bool readResult;
|
bool readResult;
|
||||||
string readMessage = "";
|
string readMessage = "";
|
||||||
string receiptText = "";
|
string receiptText = "";
|
||||||
MessageCore messageCore = null;
|
MessageCore messageCore = null;
|
||||||
|
|
||||||
|
|
||||||
if (attachmentLocalPath == null)
|
if (attachmentLocalPath == null)
|
||||||
@ -133,7 +133,7 @@ namespace bsmd.ExcelReadService
|
|||||||
// Quittung / set messagecore to createreport and let reportGenerator create a reply?
|
// Quittung / set messagecore to createreport and let reportGenerator create a reply?
|
||||||
if (Properties.Settings.Default.SendConfirmationSheet)
|
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)));
|
string.Format("{0}_confirm.xls", Path.GetFileNameWithoutExtension(attachmentLocalPath)));
|
||||||
|
|
||||||
if (reader.SaveCopy(confirmationFileName))
|
if (reader.SaveCopy(confirmationFileName))
|
||||||
@ -145,7 +145,7 @@ namespace bsmd.ExcelReadService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receiptText.Length > 0)
|
if (receiptText.Length > 0)
|
||||||
@ -159,7 +159,7 @@ namespace bsmd.ExcelReadService
|
|||||||
// remove attachment
|
// remove attachment
|
||||||
_log.InfoFormat("removing local file {0}", attachmentLocalPath);
|
_log.InfoFormat("removing local file {0}", attachmentLocalPath);
|
||||||
|
|
||||||
if(!Properties.Settings.Default.TestMode)
|
if (!Properties.Settings.Default.TestMode)
|
||||||
File.Delete(attachmentLocalPath);
|
File.Delete(attachmentLocalPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,8 @@ using System.IO;
|
|||||||
using OpenPop.Pop3;
|
using OpenPop.Pop3;
|
||||||
using OpenPop.Mime;
|
using OpenPop.Mime;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using System.Net.Security;
|
||||||
|
|
||||||
namespace bsmd.email
|
namespace bsmd.email
|
||||||
{
|
{
|
||||||
@ -28,7 +30,10 @@ namespace bsmd.email
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.pop3Client = new Pop3Client();
|
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.pop3Client.Authenticate(Properties.Settings.Default.POP3User, Properties.Settings.Default.POP3Password);
|
||||||
this._connected = true;
|
this._connected = true;
|
||||||
}
|
}
|
||||||
@ -39,6 +44,14 @@ namespace bsmd.email
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Diese Funktion validiert *jedes* Zertifikat und ist eigentlich scheiße. Das geht nur so im abgeschlossenen BSMD Netz!
|
||||||
|
/// </summary>
|
||||||
|
public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsConnected { get { return this._connected; } }
|
public bool IsConnected { get { return this._connected; } }
|
||||||
|
|
||||||
public bool ReceiveSingleMail(out string attachmentLocalFile, out string messageId, out string sender)
|
public bool ReceiveSingleMail(out string attachmentLocalFile, out string messageId, out string sender)
|
||||||
@ -50,7 +63,7 @@ namespace bsmd.email
|
|||||||
if (!_connected) return false;
|
if (!_connected) return false;
|
||||||
|
|
||||||
int messageCount = this.pop3Client.GetMessageCount();
|
int messageCount = this.pop3Client.GetMessageCount();
|
||||||
if (messageCount > 0)
|
if (messageCount > (this.currentMail - 1))
|
||||||
{
|
{
|
||||||
Message mailMessage = this.pop3Client.GetMessage(this.currentMail);
|
Message mailMessage = this.pop3Client.GetMessage(this.currentMail);
|
||||||
|
|
||||||
|
|||||||
@ -114,5 +114,14 @@ namespace bsmd.email.Properties {
|
|||||||
return ((string)(this["AdminEmail"]));
|
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"]));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,5 +35,8 @@
|
|||||||
<Setting Name="AdminEmail" Type="System.String" Scope="Application">
|
<Setting Name="AdminEmail" Type="System.String" Scope="Application">
|
||||||
<Value Profile="(Default)">nsw@textbausteine.net</Value>
|
<Value Profile="(Default)">nsw@textbausteine.net</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="POP3Port" Type="System.Int32" Scope="Application">
|
||||||
|
<Value Profile="(Default)">995</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
@ -42,6 +42,9 @@
|
|||||||
<setting name="AdminEmail" serializeAs="String">
|
<setting name="AdminEmail" serializeAs="String">
|
||||||
<value>nsw@textbausteine.net</value>
|
<value>nsw@textbausteine.net</value>
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="POP3Port" serializeAs="String">
|
||||||
|
<value>995</value>
|
||||||
|
</setting>
|
||||||
</bsmd.email.Properties.Settings>
|
</bsmd.email.Properties.Settings>
|
||||||
</applicationSettings>
|
</applicationSettings>
|
||||||
</configuration>
|
</configuration>
|
||||||
Loading…
Reference in New Issue
Block a user