Open Closed

How can I disable sending emails? #7878


User avatar
0
abp1@feelaware.com created
  • ABP Framework version: v8.2.0
  • UI Type: MVC
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular):
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hello. We're using Microservice framework, .net core

We do not use the emailing, And did not setting anything. However from the beginning, the e-mail options on the Setting screen are displayed.

Auth-Server is continuously attempting to send emails.

How can I disable sending emails?

[11:03:13 ERR] Failure sending mail. System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.Sockets.SocketException (111): Connection refused at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state) --- End of stack trace from previous location --- at System.Threading.Tasks.TaskToAsyncResult.End(IAsyncResult asyncResult) at System.Net.Mail.SmtpConnection.EndInitializeConnection(IAsyncResult result) at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.InitializeConnectionCallback(IAsyncResult result) --- End of stack trace from previous location --- at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result) --- End of inner exception stack trace --- at Volo.Abp.Emailing.Smtp.SmtpEmailSender.SendEmailAsync(MailMessage mail) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(String to, String subject, String body, Boolean isBodyHtml, AdditionalEmailSendingArgs additionalEmailSendingArgs) at Volo.Abp.Emailing.BackgroundEmailSendingJob.ExecuteAsync(BackgroundEmailSendingJobArgs args) at Volo.Abp.BackgroundJobs.BackgroundJobExecuter.ExecuteAsync(JobExecutionContext context) [11:03:13 WRN] We don't recommend that you use the SmtpClient class for new development because SmtpClient doesn't support many modern protocols. Use MailKit( https://docs.abp.io/en/abp/latest/MailKit) or other libraries instead.For more information, see https://github.com/dotnet/platform-compat/blob/master/docs/DE0005.md [11:03:13 ERR] Failure sending mail. System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.Sockets.SocketException (111): Connection refused at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state) --- End of stack trace from previous location --- at System.Threading.Tasks.TaskToAsyncResult.End(IAsyncResult asyncResult) at System.Net.Mail.SmtpConnection.EndInitializeConnection(IAsyncResult result) at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.InitializeConnectionCallback(IAsyncResult result) --- End of stack trace from previous location --- at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result) --- End of inner exception stack trace --- at Volo.Abp.Emailing.Smtp.SmtpEmailSender.SendEmailAsync(MailMessage mail) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(String to, String subject, String body, Boolean isBodyHtml, AdditionalEmailSendingArgs additionalEmailSendingArgs) at Volo.Abp.Emailing.BackgroundEmailSendingJob.ExecuteAsync(BackgroundEmailSendingJobArgs args) at Volo.Abp.BackgroundJobs.BackgroundJobExecuter.ExecuteAsync(JobExecutionContext context) [11:03:13 WRN] We don't recommend that you use the SmtpClient class for new development because SmtpClient doesn't support many modern protocols. Use MailKit( https://docs.abp.io/en/abp/latest/MailKit) or other libraries instead.For more information, see https://github.com/dotnet/platform-compat/blob/master/docs/DE0005.md [11:03:13 ERR] Failure sending mail. System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.Sockets.SocketException (111): Connection refused at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state) --- End of stack trace from previous location --- at System.Threading.Tasks.TaskToAsyncResult.End(IAsyncResult asyncResult) at System.Net.Mail.SmtpConnection.EndInitializeConnection(IAsyncResult result) at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.InitializeConnectionCallback(IAsyncResult result) --- End of stack trace from previous location --- at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result) --- End of inner exception stack trace --- at Volo.Abp.Emailing.Smtp.SmtpEmailSender.SendEmailAsync(MailMessage mail) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(String to, String subject, String body, Boolean isBodyHtml, AdditionalEmailSendingArgs additionalEmailSendingArgs) at Volo.Abp.Emailing.BackgroundEmailSendingJob.ExecuteAsync(BackgroundEmailSendingJobArgs args) at Volo.Abp.BackgroundJobs.BackgroundJobExecuter.ExecuteAsync(JobExecutionContext context)


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can use NullEmailSender to implement IEmailSender. So the email will not be sent.

    context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>());

    Remove the EmailingPageContributor from SettingManagementPageOptions, then the email setting UI will be hidden

    Configure<SettingManagementPageOptions>(options =>
    {
        //options.Contributors.Remove EmailingPageContributor
    });
    
Made with ❤️ on ABP v9.0.0-preview Updated on September 18, 2024, 12:46