New account registration issues

Seeing a few issues with allow user registration.

I will start with not receiving the email after getting "Registration accepted. Please check your email for further instructions." message.

For now I am using my office365 account for testing.

Using SMTP settings specified by Microsoft.

https://support.microsoft.com/en-us/office/pop-imap-and-smtp-settings-8361e398-8af4-4e97-b147-6c6c4ac95353

Server: smtp.office365.com

Port: 587

Encryption: STARTTLS

I did debug as much as I could and did not get any exceptions thrown.

I created an account with sendinblue to try a different SMTP server, it does not work either.

sendinblue has a log. it is not showing that an email went through their server.

no row in the [AspNetUsers] table (I'm not sure what the intent is as far as when the row should be inserted?)

Getting a 200 from here, so not sure what is not working

You can try debugging the Register method in the AccountController. It is sending the emails. We are using the .NET built-in SmtpClient and just passing the credentials and server details - nothing else. This is probably some SMTP server configuration issue which is not related to the email sending code. You can easily try sending an email with the same settings from a command line application to verify it yourself.

Thank you.

I was debugging the Register method within SecurityService.cs.

Debugging in the Account Controller shows it only works multi-tenant when deployed.

I deployed and it's still not working. I don't have remote debugging setup.

The user is not getting to the db table, so might still be be in Developement?

Where can I find out if in Development environment?

It's deployed to an Azure app service, it should know it's not Development?

I'm making the assumption that it's still returning at line 165. I'll look into remote debugging.

The code that sends emails in in AccountController.

Not sure what this means.

If email sending doesn't work in development it is very unlikely to magically start working in production. You need to debug the email sending code preferably in a standalone application.

Your debugger shows it is in Development mode. I am not sure why you may have to check your Azure app settings.

When debugging locally, it hits line 165 and returns.

That is why I deployed to Azure but it still does not work.

Do you know where/how the env.EnvironmentName is set?

You can comment that code and try debugging again. Should be very easy to test.

This is explained in great detail here: Use multiple environments in ASP.NET Core | Microsoft Learn

I have the primary problem of email not working at all fixed, thank you for your help.

(It worked when I commented out the check for the environment var.

Then I was having trouble setting the environment var to prod for testing.

I had a web.config file that was overriding the environment var.

I remember when I set up my local machine on IIS that it created a web.config, it didn't make sense at the time, but I kept it anyway. I just got rid of it and everything is working)