با سلام
برای ارسال ایمیل با خطای زیر روبرو میشم.
An unhandled exception occurred while processing the request.
SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at
System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, string response)
Stack Query Cookies Headers Routing
SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at
System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, string response)
System.Net.Mail.MailCommand.Send(SmtpConnection conn, byte[] command, MailAddress from, bool allowUnicode)
System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, string deliveryNotify, bool allowUnicode, out SmtpFailedRecipientException exception)
System.Net.Mail.SmtpClient.Send(MailMessage message)
School.Utilities.EmailSender.SendEmailAsync(string email, string subject, string htmlMessage) in Sender.cs
+
30. SmtpServer.Send(mail);
School.Areas.Identity.Pages.Account.RegisterModel.OnPostAsync(string returnUrl) in Register.cshtml.cs
+
121. await _emailSender.SendEmailAsync(Input.Email, "فعالسازی حساب کاربری",
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory+GenericTaskHandlerMethod.Convert<T>(object taskAsObject)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory+GenericTaskHandlerMethod.Execute(object receiver, object[] arguments)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Show raw exception details
در اینترنت متن کامل خطا رو سرچ کردم و صفحه دادن سطح دسترسی به حساب جهت ارسال ایمیل رو گرفته و تونستم یک کاربر، با نقش ادمین ایجاد کنم. ولی برای ایجاد یوزری با نقش Customer خطای فوق رو دریافت می کنم.
چه تنظیمی در حساب ایمیلی که از طریق اون ایمیلهای مربوط قرار است فرستاده بشه، انجام بدم که هربار با خطای فوق مواجه نشم.
در ضمن بعد از بروز خطای فوق، رکورد در بانک ایجاد ولی ایمیل ارسال نمیشه.
سلام
https://www.google.com/settings/security/lesssecureapps
2 --
http://www.smarterasp.net/support/kb/a1546/send-email-from-gmail-with-smtp-authentication-but-got-5_5_1-authentication-required-error.aspx