forked from Azure/azure-functions-host
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating SendGrid to API v3; updating all extensions
- Loading branch information
Showing
15 changed files
with
117 additions
and
100 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
#r "SendGridMail" | ||
#load "..\Shared\Message.csx" | ||
#r "SendGrid" | ||
#load "..\Shared\Order.csx" | ||
|
||
using System; | ||
using SendGrid; | ||
using SendGrid.Helpers.Mail; | ||
using Microsoft.Azure.WebJobs.Host; | ||
|
||
public static SendGridMessage Run(Order order, TraceWriter log) | ||
public static Mail Run(Order order, TraceWriter log) | ||
{ | ||
log.Info($"C# Queue trigger function processed order: {order.OrderId}"); | ||
|
||
var message = new SendGridMessage() | ||
var message = new Mail | ||
{ | ||
Subject = string.Format("Thanks for your order (#{0})!", order.OrderId), | ||
Text = string.Format("{0}, your order ({1}) is being processed!", order.CustomerName, order.OrderId) | ||
Subject = $"Thanks for your order (#{order.OrderId})!" | ||
}; | ||
message.AddTo(order.CustomerEmail); | ||
|
||
Content content = new Content | ||
{ | ||
Type = "text/plain", | ||
Value = $"{order.CustomerName}, your order ({order.OrderId}) is being processed!" | ||
}; | ||
message.AddContent(content); | ||
|
||
return message; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
$in = Get-Content $order | ||
|
||
$order = $in | ConvertFrom-Json | ||
$content = [string]::Format('{{ "Subject": "Thanks for your order (#{0})", "Text": "{1}, your order ({0}) is being processed!" }}', $order.OrderId, $order.CustomerName) | ||
$content = [string]::Format('{{ "Subject": "Thanks for your order (#{0})", "Content": [ {{ "Type": "text/plain", "Value": "{1}, your order ({0}) is being processed!" }} ] }}', $order.OrderId, $order.CustomerName) | ||
|
||
$content | Out-File -Encoding Ascii $message |
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
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
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
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
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
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
Oops, something went wrong.