I have a problem with a app service in Azure. This web service was working normally until I added a functionality to send email. I mean in local environment with visual studio it works fine, sends emails normally, but when I published in Azure it gave me an error when trying to send an email.
enter image description here
It’s a asp.net core project using Blazor wasm in .Net 7.
The flow is:
Client(view) -> Services(class library) -> Server(Controllers API) -> Repositories
As you can see in the attached image the problem originates from the EmailService.EnviarCorreo (Services project) method.
I can see that the problem is due to a null argument (Arg_NullReferenceException) in mailRequestDTO, but I was able to confirm wich mailRequestDTO has the correct information!! (not null).
I thought the problem was due to the initialization of the properties to null (MailRequestDTO class).
public string Email { get; set; } = null!;
So I changed:
public string Email { get; set; } = string.Empty;
But that didn’t work, continue the same error. So I’m here, somebody can help me please?? thank you.