JM-A21 / GraphMailRelay

A basic .NET-based background worker service for Windows intended to act as a simple and to-the-point SMTP relay for applications, services, and devices that don't natively support the Graph API, allowing these devices to still send mail in a modern and secure way.
GNU General Public License v3.0
1 stars 0 forks source link

403 Error on SendMail #21

Open jecourtney opened 6 months ago

jecourtney commented 6 months ago

Does anything need updated, the MS stuff chagnes so much?

I successfully registered the application in Entra ID. I was able to use the MS quick project (msgraph-training-dotnet) to verify my application was successfully setup asnd communicating with Graph. However, when I modify all the settings for my GraphRelay, I get a 403 Error during the SendMail call. I've given Admin Approval, correct permissions, etc. (msgraph-training-dotnet) sends mail as well and works. Any idea how to troubleshoot?

info: GraphMailRelay.SmtpWorker[2007] Worker is listening on localhost:25. Incoming mail will be accepted from the following whitelisted endpoints: 127.0.0.1 localhost info: GraphMailRelay.GraphWorker[3007] Worker has started. info: HostBuilderLogger[0] [GraphMailRelay] at UTC [2024-02-22T16:56:12.7748153+00:00] Application started normally. Emitting messages cached during HostBuilder configuration. fail: GraphMailRelay.GraphWorker[3999] Worker caught exception during Graph API request processing. System.AggregateException: One or more errors occurred. (The server returned an unexpected status code and no error factory is registered for this code: 403) ---> Microsoft.Kiota.Abstractions.ApiException: The server returned an unexpected status code and no error factory is registered for this code: 403 at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.ThrowIfFailedResponse(HttpResponseMessage response, Dictionary2 errorMapping, Activity activityForAttributes, CancellationToken cancellationToken) at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory1 factory, Dictionary2 errorMapping, CancellationToken cancellationToken) at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory1 factory, Dictionary`2 errorMapping, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at GraphMailRelay.GraphWorker.b__26_0() in C:\d-drive\project\GraphMailRelay-main\GraphMailRelay\GraphWorker.cs:line 225

Thanks!

JM-A21 commented 4 months ago

Hello @jecourtney! Sorry to have taken so long to get back to you on this. As far as I know it still works but I'll do some updates and test. Also, are you able to post a sanitized version of your app settings file without your tenant, app, and client secret values? And are you using a standard commercial Office 365 environment?