I made this on Azure portal how can I convert to send this scheduled mail in C#?
run.csx looks like;
#r "SendGrid"
using System;
using SendGrid.Helpers.Mail;
using Microsoft.Azure.WebJobs.Host;
public static Mail Run(TimerInfo myTimer, TraceWriter log)
{
var today = DateTime.Today.ToShortDateString();
log.Info($"Generating daily report for {today} at {DateTime.Now}");
Mail message = new Mail()
{
Subject = "15 DK'LIK TEST MAILI"
};
Content content = new Content
{
Type = "text/plain",
Value = "Bu mail 15 dk da bir yinelenecektir."
};
message.AddContent(content);
return message;
}
function.json looks like;
{
"bindings": [
{
"type": "timerTrigger",
"name": "myTimer",
"schedule": "0 */15 * * * *",
"direction": "in"
},
{
"type": "sendGrid",
"name": "$return",
"direction": "out",
"apiKey": "CustomSendGridKeyAppSettingName",
"from": "blabla@hotmail.com",
"to": "blabla@hotmail.com"
}
],
"disabled": true
}
On C# gives 2 error. I added sendgrid nuget. How Can I pass this errors ? If I just add sengrid mail function in visual studio it gives "run" namespace error. When I copy my portal code in here it has started to give "run" error.