From 7049eac400479aba56ec6b06c1d2e698da348639 Mon Sep 17 00:00:00 2001 From: limited_dev Date: Thu, 8 Jun 2023 23:29:35 +0200 Subject: [PATCH] feat: added Email connectivity Signed-off-by: limited_dev --- ImageBoardServerApp/Program.cs | 4 ++++ ImageBoardServerApp/Util/Postman.cs | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 ImageBoardServerApp/Util/Postman.cs diff --git a/ImageBoardServerApp/Program.cs b/ImageBoardServerApp/Program.cs index a1e72ce..a92225f 100644 --- a/ImageBoardServerApp/Program.cs +++ b/ImageBoardServerApp/Program.cs @@ -1,5 +1,6 @@ using ImageBoardServerApp.Auth; using ImageBoardServerApp.Data; +using ImageBoardServerApp.Util; using ImageThumbnail.AspNetCore.Middleware; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage; @@ -43,4 +44,7 @@ ImageThumbnailOptions options = new ImageThumbnailOptions("wwwroot/img/", "thumb options.ImageQuality = 75L; app.UseImageThumbnail(options); +//Log onto Mail Server +Postman.logon(); + app.Run(); \ No newline at end of file diff --git a/ImageBoardServerApp/Util/Postman.cs b/ImageBoardServerApp/Util/Postman.cs new file mode 100644 index 0000000..0ac78b3 --- /dev/null +++ b/ImageBoardServerApp/Util/Postman.cs @@ -0,0 +1,25 @@ +using System.Net; +using System.Net.Mail; + +namespace ImageBoardServerApp.Util; + +public static class Postman +{ + private static SmtpClient smtpClient; + + public static void logon() + { + smtpClient = new SmtpClient("smtp.bulletboards.xyz") + { + Port = 587, + Credentials = new NetworkCredential("noreply@bulletboards.xyz", "frogARdI,97,#"), + EnableSsl = true, + }; + } + + public static void sendMail(string to, string subj, string body) + { + smtpClient.Send("noreply@bulletboards.xyz", to, subj, body); + } + +} \ No newline at end of file