feat: email config is now loaded from fs
Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
parent
31409be192
commit
766e6054dc
4 changed files with 19 additions and 3 deletions
|
@ -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<string, object> values = new Dictionary<string, object>();
|
||||
|
||||
public static void loadConfig()
|
||||
{
|
||||
values =
|
||||
JsonConvert.DeserializeObject<Dictionary<string, object>>(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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue