I want to send my all register user weekly news letter so i need to send email for every week after deploying server by automatic process but i can't find in asp.net core 2.2 how can i do this before i done this same thing in asp.net Mvc with global file but i can't understand in core how can i do this please give me some helpful solution. Email code working find
public bool SendEmail(string email, string subjec, string body, string name)
{
try
{
string senderMail = "*****";
string senderPass = "*****";
string MailHostServer = "*******";
string port = "587";
string displayName = "Account Activation";
MailMessage mail = new MailMessage();
mail.From = new MailAddress(senderMail, displayName);
mail.To.Add(email);
mail.Subject = subjec;
mail.IsBodyHtml = true;
mail.Body = body;
mail.Priority = MailPriority.Normal;
var stmp = new SmtpClient();
stmp.Credentials = new NetworkCredential(senderMail, senderPass);
stmp.Host = MailHostServer;
stmp.Port = Convert.ToInt32(port);
stmp.EnableSsl = true;
stmp.Send(mail);
return true;
}
catch (Exception e)
{
return false;
}
}