static async Task Execute(string emailAddress, string apiKey, LaiThuModel model) { var client = new SendGridClient(apiKey); var from = new EmailAddress(emailAddress, "Bitwin team"); var subject = "Thong tin khach hang"; var plainTextContent = "Bitwin"; var htmlContent = $"Dong xe:{model.DongXe}, Ho ten:{model.HoTen},Email:{emailAddress}, Dien thoai:{model.DienThoai},Dia chi: {model.DiaChi}"; try { var to = new EmailAddress("*****@*****.**", "*****@*****.**"); var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent); var response = await client.SendEmailAsync(msg); Logger.Log(htmlContent, "SendGrid"); } catch (Exception e) { Logger.Log(e, "SendGrid"); } }
public void Main(string emailAddress, string apiKey, LaiThuModel model) { Execute(emailAddress, apiKey, model).Wait(); }