36 lines
No EOL
988 B
C#
36 lines
No EOL
988 B
C#
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(values["email-server"].ToString())
|
|
{
|
|
Port = 587,
|
|
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(values["email-address"].ToString(), to, subj, body);
|
|
}
|
|
|
|
} |