diff --git a/.gitignore b/.gitignore index e6a2ded..6c32a64 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ ImageBoardServerApp/wwwroot/img/dynamic *.db-shm *.db-wal Migrations/ +/ImageBoardServerApp/Data/creds.json ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. diff --git a/ImageBoardServerApp/ImageBoardServerApp.csproj b/ImageBoardServerApp/ImageBoardServerApp.csproj index 138d862..cbededf 100644 --- a/ImageBoardServerApp/ImageBoardServerApp.csproj +++ b/ImageBoardServerApp/ImageBoardServerApp.csproj @@ -15,6 +15,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/ImageBoardServerApp/Program.cs b/ImageBoardServerApp/Program.cs index a92225f..9ba9a9b 100644 --- a/ImageBoardServerApp/Program.cs +++ b/ImageBoardServerApp/Program.cs @@ -44,6 +44,9 @@ ImageThumbnailOptions options = new ImageThumbnailOptions("wwwroot/img/", "thumb options.ImageQuality = 75L; app.UseImageThumbnail(options); +//Load mail config +Postman.loadConfig(); + //Log onto Mail Server Postman.logon(); diff --git a/ImageBoardServerApp/Util/Postman.cs b/ImageBoardServerApp/Util/Postman.cs index 0ac78b3..dd3a01b 100644 --- a/ImageBoardServerApp/Util/Postman.cs +++ b/ImageBoardServerApp/Util/Postman.cs @@ -1,25 +1,36 @@ using System.Net; using System.Net.Mail; +using Newtonsoft.Json; namespace ImageBoardServerApp.Util; public static class Postman { private static SmtpClient smtpClient; + + public static Dictionary values = new Dictionary(); + + public static void loadConfig() + { + values = + JsonConvert.DeserializeObject>(File.ReadAllText("Data/creds.json")); + Console.WriteLine(File.ReadAllText("Data/creds.json")); + } + public static void logon() { - smtpClient = new SmtpClient("smtp.bulletboards.xyz") + smtpClient = new SmtpClient(values["email-server"].ToString()) { Port = 587, - Credentials = new NetworkCredential("noreply@bulletboards.xyz", "frogARdI,97,#"), + Credentials = new NetworkCredential(values["email-address"].ToString(), values["email-password"].ToString()), EnableSsl = true, }; } public static void sendMail(string to, string subj, string body) { - smtpClient.Send("noreply@bulletboards.xyz", to, subj, body); + smtpClient.Send(values["email-address"].ToString(), to, subj, body); } } \ No newline at end of file