P
P
password222022-02-06 16:57:39
Nginx
password22, 2022-02-06 16:57:39

How to set up Gmail SMTP on ubuntu + nginx + asp.net?

Good afternoon. I want to use email confirmation to register on the site. When I ran the project in visual studio, the mail came in as it should. But with the site uploaded to the server, the following error already pops up when trying to register:

Feb 06 16:38:14 testvds dotnet[707484]: fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
Feb 06 16:38:14 testvds dotnet[707484]:       An unhandled exception has occurred while executing the request.
Feb 06 16:38:14 testvds dotnet[707484]:       MailKit.Security.AuthenticationException: 534: 5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbt
Feb 06 16:38:14 testvds dotnet[707484]:       5.7.14 A-_pDOhSafDTp_etpXkmB3ppujBWY7knRO_vyxd1BTaqSTE1zzL3aW5TIVRWrkPxuZXDQ
Feb 06 16:38:14 testvds dotnet[707484]:       5.7.14 9UxknBuGN0Nq4A7XL-J2qwN78JmSrSapV-mcVa9R6XbYAIHD3bwZgUOfVvI0hST5>
Feb 06 16:38:14 testvds dotnet[707484]:       5.7.14 Please log in via your web browser and then try again.
Feb 06 16:38:14 testvds dotnet[707484]:       5.7.14  Learn more at
Feb 06 16:38:14 testvds dotnet[707484]:       5.7.14  https://support.google.com/mail/answer/78754 x9sm1102550lfr.141 - gsmtp
Feb 06 16:38:14 testvds dotnet[707484]:        ---> MailKit.Net.Smtp.SmtpCommandException: 5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbt
Feb 06 16:38:14 testvds dotnet[707484]:       5.7.14 A-_pDOhSafDTp_etpXkmB3ppujBWY7knRO_vyxd1BTaqSTE1zzL3aW5TIVRWrkPxuZXDQ
Feb 06 16:38:14 testvds dotnet[707484]:       5.7.14 9UxknBuGN0Nq4A7XL-J2qwN78JmSrSapV-mcVa9R6XbYAIHD3bwZgUOfVvI0hST5>
Feb 06 16:38:14 testvds dotnet[707484]:       5.7.14 Please log in via your web browser and then try again.
Feb 06 16:38:14 testvds dotnet[707484]:       5.7.14  Learn more at
Feb 06 16:38:14 testvds dotnet[707484]:       5.7.14  https://support.google.com/mail/answer/78754 x9sm1102550lfr.141 - gsmtp
Feb 06 16:38:14 testvds dotnet[707484]:          --- End of inner exception stack trace ---
Feb 06 16:38:14 testvds dotnet[707484]:          at MailKit.Net.Smtp.SmtpClient.AuthenticateAsync(Encoding encoding, ICredentials credentials, Boolean doAsync, CancellationToken cancellationToken)
Feb 06 16:38:14 testvds dotnet[707484]:          at MetanitConfirmEmail.Services.EmailService.SendEmailAsync(String email, String subject, String message) in C:\Users\user\source\repos\MyProject\Services\EmailService.cs:line 24
...


I'm looking for information on setting up smtp in nginx but can't find anything. Maybe I just need to open some ports, but again I can’t find anything on the Internet
I tried to look for a problem in support google, but I didn’t find anything either

I would be glad for any help, thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2022-02-06
@password22

I'm looking for information on setting up smtp in nginx but can't find anything.

And you won't find it, because Nginx has nothing to do with your problem. Of course, Nginx can act as a mail-proxy, but this is not your case.
Your application reports that there is a problem with authentication, you should probably generate an application password and use it for authentication.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question