Black Rock Reporting Azure Function
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

MailSenderFunction.cs 1.3KB

3 лет назад
3 лет назад
3 лет назад
3 лет назад
123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.IO;
  3. using Microsoft.Azure.Functions.Worker;
  4. using Microsoft.Extensions.Logging;
  5. using SendGrid.Helpers.Mail;
  6. using Microsoft.Azure.WebJobs;
  7. namespace BlackRockReportFunction
  8. {
  9. public class MailSenderFunction
  10. {
  11. private readonly ILogger _logger;
  12. public MailSenderFunction(ILoggerFactory loggerFactory)
  13. {
  14. _logger = loggerFactory.CreateLogger<MailSenderFunction>();
  15. }
  16. //http://127.0.0.1:10000/devstoreaccount1/report-container
  17. [Function("MailSenderFunction")]
  18. public SendGridMessage Run([BlobTrigger("report-container/{name}", Connection = "AzureWebJobsStorage")] string fileData, string fileName)
  19. {
  20. _logger.LogInformation($"C# Blob trigger function Processed blob\n New file detected with name: {fileName}");
  21. return null;
  22. //var msg = new SendGridMessage()
  23. //{
  24. // From = new EmailAddress("nikola.jovanovic@dilig.net", "Nikola Jovanovic"),
  25. // Subject = "Test SendGrid Azure Function",
  26. // PlainTextContent = String.Format("If you read this text, then congratulations," +
  27. // " you did it! :)")
  28. //};
  29. //msg.AddTo(new EmailAddress("nikolajovanovic3579@gmail.com", "Nikola Jovanovic"));
  30. //return msg;
  31. }
  32. }
  33. }