update 20241210
This commit is contained in:
@@ -2,10 +2,14 @@
|
||||
using API_NetFramework.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlTypes;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
using System.Web.Http;
|
||||
using System.Web.Management;
|
||||
|
||||
namespace OnDocAPI_NetFramework.Controllers
|
||||
{
|
||||
@@ -27,10 +31,30 @@ namespace OnDocAPI_NetFramework.Controllers
|
||||
{
|
||||
return Content(HttpStatusCode.Forbidden, empfaenger + ": Email nicht bei der TKB - Mail nicht versandt");
|
||||
}
|
||||
string s = "";
|
||||
try
|
||||
{
|
||||
s = System.Configuration.ConfigurationManager.AppSettings["MailParam"];
|
||||
|
||||
|
||||
return Content(HttpStatusCode.OK, "Mail versand noch nicht implementiert");
|
||||
//return Content(HttpStatusCode.OK, empfaenger + ": Mail versandt");
|
||||
s = s.Replace("$$empfaenger$$", empfaenger);
|
||||
s = s.Replace("$$betreff$$", betreff);
|
||||
s = s.Replace("$$body$$", message);
|
||||
string debugdir = System.Configuration.ConfigurationManager.AppSettings["DebugDir"];
|
||||
string tmpfile = debugdir + @"\Mail_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".ps1";
|
||||
StreamWriter writer = new StreamWriter(tmpfile);
|
||||
writer.Write(s);
|
||||
writer.Close();
|
||||
writer.Dispose();
|
||||
System.Diagnostics.Process.Start("powershell.exe", tmpfile);
|
||||
APILogging.Log((HttpRequestMessage)Request, "Mail Versand: " + s, LogLevelType.Debug);
|
||||
//return Content(HttpStatusCode.OK, "Mail versand noch nicht implementiert");
|
||||
return Content(HttpStatusCode.OK, empfaenger + ": Mail versandt");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
APILogging.Log((HttpRequestMessage)Request, "Mail Versand NOK: " + e.Message+" " + s, LogLevelType.Debug);
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user