public static async Task Run( [TimerTrigger("0 0 17 * * *", RunOnStartup = false)] TimerInfo myTimer, ILogger log, ExecutionContext context, [SendGrid()] IAsyncCollector <SendGridMessage> messageCollector) { log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); string warnings = await ReportProcessor.GetLastDaysHtmlReport(7, true); string all = await ReportProcessor.GetLastDaysHtmlReport(7, false); await SendReportHttp.SendEmail(warnings, all, context, messageCollector); }
public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log, ExecutionContext context, [SendGrid()] IAsyncCollector <SendGridMessage> messageCollector) { log.LogInformation("C# HTTP trigger function processed a request."); string warnings = await ReportProcessor.GetLastDaysHtmlReport(7, true); string all = await ReportProcessor.GetLastDaysHtmlReport(7, false); string content = await SendEmail(warnings, all, context, messageCollector); return(new ContentResult() { Content = content, ContentType = "text/html", }); }