feat: added Email connectivity

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-06-08 23:29:35 +02:00
parent b05eba37f1
commit 7049eac400
2 changed files with 29 additions and 0 deletions

View file

@ -1,5 +1,6 @@
using ImageBoardServerApp.Auth; using ImageBoardServerApp.Auth;
using ImageBoardServerApp.Data; using ImageBoardServerApp.Data;
using ImageBoardServerApp.Util;
using ImageThumbnail.AspNetCore.Middleware; using ImageThumbnail.AspNetCore.Middleware;
using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage; using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
@ -43,4 +44,7 @@ ImageThumbnailOptions options = new ImageThumbnailOptions("wwwroot/img/", "thumb
options.ImageQuality = 75L; options.ImageQuality = 75L;
app.UseImageThumbnail(options); app.UseImageThumbnail(options);
//Log onto Mail Server
Postman.logon();
app.Run(); app.Run();

View file

@ -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);
}
}