Base solution for your next web application
Open Closed

Authentication required error while connecting to AWS SES(SMTP) #10977


User avatar
0
sumitshah created
  • What is your product version => NetCore 2.2
  • What is your product type (Angular or MVC) => Angular
  • What is product framework type (.net framework or .net core) =>

If issue related with ABP Framework

  • What is ABP Framework version => 4.9.0.0
 ERROR 2022-03-21 07:59:28,422 [179  ] Mvc.ExceptionHandling.AbpExceptionFilter - Authentication required
MailKit.ServiceNotAuthenticatedException: Authentication required
   at MailKit.Net.Smtp.SmtpClient.ProcessMailFromResponse(MimeMessage message, MailboxAddress mailbox, SmtpResponse response)
   at MailKit.Net.Smtp.SmtpClient.MailFromAsync(FormatOptions options, MimeMessage message, MailboxAddress mailbox, SmtpExtension extensions, Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.SendAsync(FormatOptions options, MimeMessage message, MailboxAddress sender, IList`1 recipients, Boolean doAsync, CancellationToken cancellationToken, ITransferProgress progress)
   at Abp.MailKit.MailKitEmailSender.SendEmailAsync(MailMessage mail)
   at Abp.Net.Mail.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize)
   at Infogroup.IDMS.Authorization.Users.UserEmailer.ReplaceBodyAndSend(String emailAddress, String subject, StringBuilder emailTemplate, StringBuilder mailMessage) in C:\_work\1\s\src\Infogroup.IDMS.Core\Authorization\Users\UserEmailer.cs:line 339
   at Infogroup.IDMS.Authorization.Users.UserEmailer.SendPasswordResetLinkAsync(User user, String link) in C:\_work\1\s\src\Infogroup.IDMS.Core\Authorization\Users\UserEmailer.cs:line 167
   at Infogroup.IDMS.Authorization.Accounts.AccountAppService.SendPasswordResetCode(SendPasswordResetCodeInput input) in C:\_work\1\s\src\Infogroup.IDMS.Application\Authorization\Accounts\AccountAppService.cs:line 122
   at lambda_method(Closure , Object )
   at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()

8 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @sumitshah

    Did you configure your SMTP settings on settings page and set username & password ?

  • User Avatar
    0
    sumitshah created

    Hi ismcagdas,

    We have set following properties under AbpSettings table.

    Abp.Net.Mail.Smtp.Host Abp.Net.Mail.Smtp.UserName Abp.Net.Mail.Smtp.Password Abp.Net.Mail.Smtp.EnableSsl Abp.Net.Mail.Smtp.Port

    Not sure what setting page you are refering to.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I'm referring to this page https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Features-Angular-Host-Settings#email. It basically sets the similar settings.

  • User Avatar
    0
    sumitshah created

    Hello ismcagdas,

    When we are trying to open setting that you have suggested above, we are getting following exception.

    ERROR 2022-03-23 01:45:36,967 [241 ] Mvc.ExceptionHandling.AbpExceptionFilter - The input data is not a complete block.
    System.Security.Cryptography.CryptographicException: The input data is not a complete block.
    at Internal.Cryptography.UniversalCryptoDecryptor.UncheckedTransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
    at Internal.Cryptography.UniversalCryptoTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
    at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
    at System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing)
    at Abp.Runtime.Security.SimpleStringCipher.Decrypt(String cipherText, String passPhrase, Byte[] salt)
    at Infogroup.IDMS.Configuration.Tenants.TenantSettingsAppService.GetEmailSettingsAsync() in C:\_work\1\s\src\Infogroup.IDMS.Application\Configuration\Tenants\TenantSettingsAppService.cs:line 102
    at Infogroup.IDMS.Configuration.Tenants.TenantSettingsAppService.GetAllSettings() in C:\_work\1\s\src\Infogroup.IDMS.Application\Configuration\Tenants\TenantSettingsAppService.cs:line 47
    at lambda_method(Closure , Object )
    at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
    at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
    at System.Threading.Tasks.ValueTask`1.get_Result()
    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Could you delete All settings with "Abp.Net.Mail.Smtp.*" from the DB and try to open the settings page again ? Normally the value of Abp.Net.Mail.Smtp.Password is stored as encrypted but I think you entered a non-encrpyted text into its value.

  • User Avatar
    0
    sumitshah created

    Hello, I tried deleting all smptp props, we are still unable to open Settings on UI. Could you please suggest if there is any way to avoid encryption while reading password from abpSetting?

  • User Avatar
    0
    musa.demir created

    Hi @sumitshah Can you please share your AspNet Zero version?

  • User Avatar
    0
    sumitshah created

    We are able to resolve this problem after clearing all ABPSettings and placing them back using tenantSettings.

    Thanks for your help!