using System.Net.Mail;
using System.Text;
namespace cadre_mgmt_system
{
public class Email
{
public void SendEmail(string To, string Subject, string Body)
{
if (To != "" || string.IsNullOrWhiteSpace(To))
{
MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress("support.pms@icar.gov.in");
mailMessage.To.Add(To);
mailMessage.Subject = Subject;
mailMessage.Body = Body;
mailMessage.IsBodyHtml = true;
mailMessage.BodyEncoding = Encoding.UTF8;
mailMessage.Priority = MailPriority.High;
SmtpClient smtpClient = new SmtpClient();
smtpClient.Host = "10.100.3.109";
smtpClient.Port = 25;
smtpClient.EnableSsl = false;
smtpClient.Send(mailMessage);
}
}
}
}
No comments:
Post a Comment