public async Task Execute(string email, string subject, string body) { _mailJetSettings = _configuration.GetSection("MailJet").Get <MailJetSettings>(); MailjetClient client = new MailjetClient(_mailJetSettings.ApiKey, _mailJetSettings.SecretKey) { Version = ApiVersion.V3_1, }; MailjetRequest request = new MailjetRequest { Resource = Send.Resource, } .Property(Send.Messages, new JArray { new JObject { { "From", new JObject { { "Email", "*****@*****.**" }, { "Name", "Ben" } } }, { "To", new JArray { new JObject { { "Email", email }, { "Name", "DotNetMastery" } } } }, { "Subject", subject }, { "HTMLPart", body } } }); await client.PostAsync(request); }
public async Task Execute(string email, string subject, string body) { _mailJetSettings = _configuration.GetSection("MailJet").Get <MailJetSettings>(); var client = new MailjetClient(_mailJetSettings.ApiKey, _mailJetSettings.SecretKey); var request = new MailjetRequest { Resource = Send.Resource } .Property(Send.FromEmail, "*****@*****.**") .Property(Send.FromName, "DotNetMastery") .Property(Send.Subject, subject) .Property(Send.HtmlPart, body) .Property(Send.Recipients, new JArray { new JObject { { "Email", email } } }); await client.PostAsync(request); }