using MimeKit; using MailKit.Net.Smtp; using System.Threading.Tasks; namespace HyperCube { public class EmailSender { public async Task SendEmailAsync(string email, string subject, string message) { var emailMessage = new MimeMessage(); emailMessage.From.Add(new MailboxAddress("qhash.ru", "registration@qhash.ru")); emailMessage.To.Add(new MailboxAddress("", email)); emailMessage.Subject = subject; emailMessage.Body = new TextPart(MimeKit.Text.TextFormat.Html) { Text = message }; using (var client = new SmtpClient()) { await client.ConnectAsync("mail.qhash.ru", 465, true); await client.AuthenticateAsync("registration@qhash.ru", "4sI:KN5Ssh_tU"); await client.SendAsync(emailMessage); await client.DisconnectAsync(true); } } } }