public void Send(Mail _mail) { _testRespository.Send(_mail); }
public void Send(Mail _mail) { using (MailMessage mail = new MailMessage()) //class exist in system.net { mail.From = new MailAddress(_mail.EmailFrom);// mail.To.Add(_mail.EmailTo); mail.Subject = _mail.Subject; mail.Body = _mail.Message; mail.IsBodyHtml = true; using (SmtpClient smtp = new SmtpClient(_mail.SmtpAddress, _mail.PortNumber)) { smtp.Credentials = new NetworkCredential(_mail.EmailFrom, _mail.Password); smtp.EnableSsl = true; smtp.Send(mail); } _database.SendMail(true); } }