Ok, this is very strange!
I have a code that sends scheduled emails to people using sendgrid api (Sendgrid 8.0.5) . It works fine on my local system, but on Azure (on app services) it just ignores the SendAt time.
public async Task SendVotingTimeIsUpEmail(model)
{
sg = new SendGridAPIClient(SettingsHelper.Instance.EmailApiKey, "https://api.sendgrid.com");
Email from = new Email(SettingsHelper.Instance.Sender);
Email to = new Email(user.Email);
Content content = new Content("text/html", "content");
Mail mailSt = new Mail(from, "subject", to, content) { TemplateId = SettingsHelper.Instance.VotingTimeIsUpTemplateId };
var datetimeOffset = new DateTimeOffset(model.ExpirationDate.Value, TimeSpan.Zero);
mailSt.SendAt = datetimeOffset.ToUnixTimeSeconds();
System.Diagnostics.Trace.TraceInformation($"Send at {mailSt.SendAt}");
dynamic response = await sg.client.mail.send.post(requestBody: mailSt.Get());
}
I tried it 5 minutes ago. This is what I have in my log:
Send at 1480594002 (which is Thu, 01 Dec 2016 12:06:42 GMT)
And today is Nov. 30th, so I do not expect it to send the message now. But I just have received it in my email.
Any Idea?