Last active
November 27, 2016 09:46
-
-
Save sjwaight/9cd20d2cfc2730aedafeb3762b3887ab to your computer and use it in GitHub Desktop.
Azure Function that uses a SendGrid output binding to send email.
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
#r "Microsoft.Azure.WebJobs.Extensions.SendGrid" | |
using SendGrid.Helpers.Mail; | |
public static void run(out Mail message) | |
{ | |
// see the associted function.json & projcet.json files for how to get this working. | |
// function.json: https://gist.github.com/sjwaight/1394817ab84f8b6688a11be8621364fb | |
// project.json: https://gist.github.com/sjwaight/0c2392236b56ef914f0b4b10b786a8fb | |
// NOTE: no need to set the 'sender/from' property as the output binding does that for us. | |
var personalization = new Personalization(); | |
personalization.AddTo(new Email("simon.waight@kloud.com.au")); | |
var messageContent = new Content("text/html", "My fantastic mail body contents here."); | |
message = new Mail(); | |
message.AddContent(messageContent); | |
message.AddPersonalization(personalization); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment