Base solution for your next web application
Open Closed

Sending email using SendGrid API in ASP.Net Zero project (Angular + ASP.Net Core) #8953


User avatar
0
csona created

Hello,

I have configured SendGrid with ASP.Net zero in the following way

  • Commented this section in {MyProject}CoreModule.cs
 if (DebugHelper.IsDebug)
 {
    //Disabling email sending in debug mode
    //Configuration.ReplaceService<IEmailSender, NullEmailSender>(DependencyLifeStyle.Transient);
 }
  • Implemented my own class derived from IEmailSender and configured in the following way
Configuration.ReplaceService<IEmailSender, SendGridEmailSender>(DependencyLifeStyle.Transient);

The code gets executed without any errors but emails are not getting sent as exptected. If I execute the same code outside in another test project then the eamils are sent.

Is there any step that I need to do? I could not find any specific documentation for this.

Thanks in advance.


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

    Hi,

    When you debug your code, can you see a breakpoint hit in your SendGridEmailSender class ?

  • User Avatar
    0
    csona created

    Hi,

    Yes, it was an issue related to the SenGrid configuration and its resolved now.

    Thanks for your help.