I noticed there was something wrong with my store when the emails stop sending automatically. Going to logs I see plenty of errors (about 1/min), all with the same message. After some investigation I found out that every time I restarted the store and the tasks are automatically executed there would be an error for each of them. The error is the following:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
--- End of inner exception stack trace ---
at System.Net.WebClient.GetWebResponse(WebRequest request)
at System.Net.WebClient.DownloadBits(WebRequest request, Stream writeStream)
at System.Net.WebClient.UploadBits(WebRequest request, Stream readStream, Byte buffer, Int32 chunkSize, Byte header, Byte footer)
at System.Net.WebClient.UploadValues(Uri address, String method, NameValueCollection data)
at Nop.Services.Tasks.TaskThread.Run() in D:\OneDrive\OneDrive\PROJETOS\STORE\NOPCOMMERCE_STORE\Libraries\Nop.Services\Tasks\TaskThread.cs:line 65
So, each time a task is run by the scheduler I get that error, but if I run the task manually, by clicking the run now button the task runs without problems (and emails are sent if on the email task).
I notice something strange on the last line of the error, it quotes a file that is not on the www root, it's on onedrive, which is very strange. Any clue if it may be the source of the problem?
I've seen plenty of answers to similar problems sugesting adding https to the store name in the setting and enabling the fore ssl on all pages. I've tried with SSL enabled everywhere and with it disabled but there was no difference.
Hopefully someone can help!