public IEnumerable <string> Post([FromBody] EmailJson value) { //var token = Config["GaiaToken"]; //var client = new RestClient("https://hub.blockstack.org/store/1PoZGGAuQ4yPj72TrXbG4pKbgB9tvCUqQ1/blockusign/global.index.json"); //var request = new RestRequest(Method.POST); //request.AddHeader("postman-token", "58f77a8d-e43a-907c-a510-011bbdf2b0f6"); //request.AddHeader("cache-control", "no-cache"); //request.AddHeader("content-type", "application/json"); //request.AddHeader("authorization", token); //request.AddParameter("application/json", "\"bye\"", ParameterType.RequestBody); //IRestResponse response = client.Execute(request) return(new string[] { "" }); }
public async Task <IEnumerable <string> > Post([FromBody] EmailJson value) { var apiKey = Config["SendGridKey"]; var client = new SendGridClient(apiKey); var from = new EmailAddress("*****@*****.**", "Blockusign"); var sub = value.subject; //"PLease review new document id ref1234"; var too = new EmailAddress(value.to, ""); //var plainTextContent = "and easy to do anywhere, even with C#"; var htmlContent = value.content;//"<strong>and easy to do anywhere, even with C#</strong>"; var msg = MailHelper.CreateSingleEmail(from, too, sub, null, htmlContent); var response = await client.SendEmailAsync(msg); var result = "error"; if (response.StatusCode == System.Net.HttpStatusCode.Accepted) { result = "ok"; } return(new string[] { result }); }