using System.Configuration;
static string emailFrom = ConfigurationManager.AppSettings["emailFrom"];
static string smtpServerSource = ConfigurationManager.AppSettings["smtpServer"];
static string emailLocation = ConfigurationManager.AppSettings["emailNotificationLocation"];
static string emailAccount = ConfigurationManager.AppSettings["emailAccount"];
static string emailPassword = ConfigurationManager.AppSettings["emailPassword"];
static string port = ConfigurationManager.AppSettings["emailPort"];
public static void SendMessageToUser(string emailBody, string email)
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient(smtpServerSource);
SmtpServer.Port = Convert.ToInt32(port);
SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
SmtpServer.UseDefaultCredentials = false;
SmtpServer.Credentials = new NetworkCredential(emailAccount, emailPassword);
SmtpServer.EnableSsl = true;
mail.From = new MailAddress(emailFrom);
mail.To.Add(new MailAddress(email));
mail.Subject = "Crypto Affiliate";
public static void SendNotification(string x, string y, string email)
string htmlcontent = string.Empty;
string path = Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory);
string oneUp = Path.GetDirectoryName(path);
string twoUp = Path.GetDirectoryName(oneUp);
string threeUp = Path.GetDirectoryName(twoUp);
string htmlDocument = threeUp + emailLocation;
using (StreamReader sr = new StreamReader(htmlDocument))
htmlcontent = sr.ReadToEnd();
string message = htmlcontent
SendMessageToUser(message, email);