Base solution for your next web application
Open Closed

Is anyone using SendGrid emails successfully? #4661


User avatar
0
Mitch created

I've been trying to get ASP.NET Zero working with SendGrid but it's not working. I'm using ASP Core and hosting on Azure. A guy posted on here that he'd got SendGrid working 3 years ago but I've followed his advice and it's still not working. Has anyone got any examples of successfully working code for Sendgrid?


4 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    I am not familiar with SendGrid but it has a WebAPI so theoretically you could create a consumer client for the WebAPI and make the relevant requests. Just try to create an empty console application apart from Asp.Net Zero, and try to communicate with SendGrid.. If you succeed in that move that code to Asp.Net Zero environment. Solving things in small environment is better and less time consuming.

  • User Avatar
    2
    davidharrison created

    Hi Mitch,

    I realise this post is 10 months old but in case you're still stuck with SendGrid or for other readers, I've got a working SendGrid configuration in .Net Zero and my solution is also hosted in Azure and SendGrid works from Production as well as in Dev.

    On the Email(SMTP) tab under admin -> settings, I have it configured as follows:

    • Default from (sender) email address: Set to address of choice
    • Default from (sender) display name: Set to address of choice
    • SMTP host: smtp.sendgrid.net
    • SMTP port: 587
    • Use SSL: unchecked
    • Use default credentials: unchecked
    • Domain name: sendgrid.net
    • User name: Your SendGrid Username
    • Password: Your SendGrid Password

    Hope this helps :)

  • User Avatar
    0
    Mitch created

    Hi @davidharrison

    Only just seen this, many thanks for your input, that's really helpful.

    Mitch

  • User Avatar
    0
    eamonkeane created

    Hey Mitch,

    I'm also using sendgrid.

    However I use the following settings.

    Default from (sender) email address address of choice Default from (sender) display name displayname of choice SMTP host smtp.sendgrid.net SMTP port 465 Use SSL checked Use default credentials unchecked Domain name sendgrid.net User name apikey Password api key generated in sendgrid.

    *** If you are testing this code locally and you're running in debug mode, the application will not send the emails, only log them.

    To get around this, i just commented out this code in {YourProjectName}.CoreModule.cs

    if (DebugHelper.IsDebug)
                {
                    //Disabling email sending in debug mode
                    //Configuration.ReplaceService<IEmailSender, NullEmailSender>(DependencyLifeStyle.Transient);
                }