0
    
    
        
                    alper created
                    
                    
                
                            Support Team
                            Director
                    
                How can I switch to my custom email sender service, other than the default one.
1 Answer(s)
- 
    0You can create a new class inherits from IEmailSenderpublic class MyCustomEmailSender : IEmailSender { public Task SendAsync(string to, string subject, string body, bool isBodyHtml = true) { throw new System.NotImplementedException(); } public Task SendAsync(string @from, string to, string subject, string body, bool isBodyHtml = true) { throw new System.NotImplementedException(); } public Task SendAsync(MailMessage mail, bool normalize = true) { throw new System.NotImplementedException(); } public Task QueueAsync(string to, string subject, string body, bool isBodyHtml = true) { throw new System.NotImplementedException(); } }alternatively, you can inherit from EmailSenderBase, so you can just override theSendEmailAsync()public class MyCustomEmailSender : EmailSenderBase { public MyCustomEmailSender(IEmailSenderConfiguration configuration, IBackgroundJobManager backgroundJobManager) : base(configuration, backgroundJobManager) { } protected override Task SendEmailAsync(MailMessage mail) { //send your email } }And replace the existing implemantation with yours in your Application project's ApplicationModule. Remove the below code section #if DEBUG context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>()); #endifand add context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, MyCustomEmailSender>());

 
                                