Created
September 28, 2018 17:18
-
-
Save imclint21/2f7a98f9c97ab7d9182a922e1c229238 to your computer and use it in GitHub Desktop.
Use SendInBlue to send confirmation mail with an activation link (use a SendInBlue template ID)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool SendConfirmationEmail(string emailAddress, string activationLink) | |
{ | |
var client = new RestClient("https://api.sendinblue.com/v3/smtp/email"); | |
var sendInBlueRequest = new RestRequest(Method.POST); | |
sendInBlueRequest.AddHeader("api-key", "SENDINBLUE_API_KEY"); | |
sendInBlueRequest.AddHeader("Accept", "application/json"); | |
sendInBlueRequest.AddHeader("Content-Type", "application/json"); | |
sendInBlueRequest.AddParameter("undefined", $"{{\"tags\":[\"Activate account for {{emailAddress}}\"],\"sender\":{{\"email\":\"[email protected]\",\"name\":\"You\"}},\"htmlContent\":\"\",\"replyTo\":{{\"email\":\"[email protected]\",\"name\":\"You\"}},\"templateId\":2,\"to\":[{{\"email\":\"{emailAddress}\",\"name\":\"{emailAddress}\"}}],\"params\":{{\"ActivationLink\":\"{activationLink}\"}}}}", ParameterType.RequestBody); | |
var sendInBlueResponse = client.Execute(sendInBlueRequest); | |
return sendInBlueResponse.IsSuccessful; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment