- Exception message and full stack trace: Mail sending failed, please check your email configuration and try again 2025-05-22 13:25:59.806 -05:00 [ERR] Error sending test email: MailKit.Net.Smtp.SmtpProtocolException: The SMTP server has unexpectedly disconnected: Authentication failed: The provided authorization grant is invalid, expired, or revoked at MailKit.Net.Smtp.SmtpStream.ReadAheadAsync(CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpStream.ReadResponseAsync(CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpStream.SendCommandAsync(String command, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.SendCommandInternalAsync(String command, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.AuthenticateAsync(Encoding encoding, ICredentials credentials, CancellationToken cancellationToken) at Volo.Abp.MailKit.MailKitSmtpEmailSender.ConfigureClient(SmtpClient client) at Volo.Abp.MailKit.MailKitSmtpEmailSender.BuildClientAsync() at Volo.Abp.MailKit.MailKitSmtpEmailSender.SendEmailAsync(MailMessage mail) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(String from, String to, String subject, String body, Boolean isBodyHtml, AdditionalEmailSendingArgs additionalEmailSendingArgs) at Volo.Abp.SettingManagement.EmailSettingsAppService.SendTestEmailAsync(SendTestEmailInput input) 2025-05-22 13:25:59.827 -05:00 [WRN] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "Mail sending failed, please check your email configuration and try again.", "details": null, "data": {}, "validationErrors": null }
2025-05-22 13:25:59.828 -05:00 [WRN] Mail sending failed, please check your email configuration and try again.
Volo.Abp.UserFriendlyException: Mail sending failed, please check your email configuration and try again.
at Volo.Abp.SettingManagement.EmailSettingsAppService.SendTestEmailAsync(SendTestEmailInput input)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope)
at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.
- Steps to reproduce the issue:
- From the Host user, create a new tenant.
- Log in as the newly created tenant.
- Navigate to the Emailing section to configure the email settings.
- Enter and save the configuration.
- Click on "Send Test Email" — the mentioned error message appears.
- Additional comments:
- I verified that the email configurations are correctly stored in Redis.
- However, they are never saved in the tenant's SQL Server database.The system reads the data from Redis to display it in the "Emailing" interface, but when performing the email sending test, it seems to try to retrieve the configurations from SQL Server. Since they don't exist there, the process fails.
- This behavior occurs both in the context of the tenants and the host.
- Project Configuration:
- ABP Studio Business Edition version 0.9.26
- Blazor Server
- Entity Framework Core
- SQL Server
- Multi-TenancyProject generated using the ABP Studio template
- **Resources consulted without success:
5 Answer(s)
-
0
hi
Can you share the content of the
AbpSettings
table?Thanks.
-
1
Hello, Below are the screenshots showing the AbpSettings information:
-
0
hi
I think your email settings can be read correctly, but the value is wrong.
You can check it by override the
MailKitSmtpEmailSender
[Dependency(ReplaceServices = true)] [ExposeServices(typeof(IMailKitSmtpEmailSender), typeof(MailKitSmtpEmailSender), typeof(MyMailKitSmtpEmailSender))] public class MyMailKitSmtpEmailSender : MailKitSmtpEmailSender, IMailKitSmtpEmailSender, ITransientDependency { public MyMailKitSmtpEmailSender( ICurrentTenant currentTenant, ISmtpEmailSenderConfiguration smtpConfiguration, IBackgroundJobManager backgroundJobManager, IOptions<AbpMailKitOptions> abpMailKitConfiguration) : base(currentTenant, smtpConfiguration, backgroundJobManager, abpMailKitConfiguration) { } protected override Task ConfigureClient(SmtpClient client) { var host = SmtpConfiguration.GetHostAsync(); var port = SmtpConfiguration.GetPortAsync(); var userName = SmtpConfiguration.GetUserNameAsync(); var password = SmtpConfiguration.GetPasswordAsync(); var domain = SmtpConfiguration.GetDomainAsync(); var enableSsl = SmtpConfiguration.GetEnableSslAsync(); var useDefaultCredentials = SmtpConfiguration.GetUseDefaultCredentialsAsync(); return base.ConfigureClient(client); } }
https://support.sendgrid.com/hc/en-us/articles/17894803361819-Troubleshooting-535-Authentication-failed-Error
-
0
Hi Thank you for your attention and time. I finally managed to solve the problem as it was a configuration issue.
-
0
Great news