|
|
|
@@ -1,4 +1,5 @@ |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using Microsoft.Azure.Functions.Worker; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using SendGrid.Helpers.Mail; |
|
|
|
@@ -14,19 +15,19 @@ namespace BlackRockReportFunction |
|
|
|
{ |
|
|
|
_logger = loggerFactory.CreateLogger<MailSenderFunction>(); |
|
|
|
} |
|
|
|
//http://127.0.0.1:10000/devstoreaccount1/report-container |
|
|
|
|
|
|
|
[Function("MailSenderFunction")] |
|
|
|
[return: SendGrid(ApiKey = "SendGridApiKey")] |
|
|
|
public SendGridMessage Run([QueueTrigger("queue1")] string myQueueItem) |
|
|
|
public SendGridMessage Run([BlobTrigger("report-container/{name}", Connection = "AzureWebJobsStorage")] string fileData, string fileName) |
|
|
|
{ |
|
|
|
_logger.LogInformation($"C# Queue trigger function processed: {myQueueItem}"); |
|
|
|
_logger.LogInformation($"C# Blob trigger function Processed blob\n Name: {fileName} \n Data: {fileData}"); |
|
|
|
|
|
|
|
var msg = new SendGridMessage() |
|
|
|
{ |
|
|
|
From = new EmailAddress("nikola.jovanovic@dilig.net", "Nikola Jovanovic"), |
|
|
|
Subject = "Test SendGrid Azure Function", |
|
|
|
PlainTextContent = String.Format("If you read this text, then congratulations," + |
|
|
|
" you did it! :) \n\n Also {0}", myQueueItem), |
|
|
|
" you did it! :)") |
|
|
|
}; |
|
|
|
|
|
|
|
msg.AddTo(new EmailAddress("nikolajovanovic3579@gmail.com", "Nikola Jovanovic")); |