Starts in:
1 DAY
3 HRS
27 MIN
38 SEC
Starts in:
1 D
3 H
27 M
38 S
Open Closed

NullEmailSender service works all environments, not only debug #4036


User avatar
0
ElifKaya created

Hi,

I want to use NullEmailSender only debug configuration. But If I don't remove NullEmailSender service like below code on other environments, I can see only log file and I can not send email from pretest environment. Is this about ABP Framework? I think it doesn't need to remove NullEmailSender service when I used if DEBUG?

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

Thanks

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

If you're creating a bug/problem report, please include followings:

ABP Framework version: v5.3.3

UI type: MVC

DB provider: EF Core

Tiered (MVC): yes

Exception message and stack trace:

Steps to reproduce the issue:"


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

    hi

    You can use SmtpEmailSender like:

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

  • User Avatar
    0
    ElifKaya created

    hi

    You can use SmtpEmailSender like:

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

    But why we need to replace again, because I used NullEmailSender only if DEBUG tag.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    I think you don't need to Remove in other environments.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06