Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Johan Andersson 2 posts 34 karma points
    Aug 18, 2020 @ 15:28
    Johan Andersson
    0

    Problem with user invite email and SendGrid

    We're currently migrating an Umbraco 7.9.2 application to Azure, and have decided to use Sendgrid for sending mail. However, we're now facing issues with the user invite mail from backoffice, when trying to invite a user the following exception is thrown "System.Net.Mail.SmtpException: The server committed a protocol violation".

    Sendgrid is configured in mailSettings in web.config according to this article https://sendgrid.com/docs/for-developers/sending-email/v2-csharp-code-example/#using-nets-built-in-smtp-library. I've also tried adding the enableSsl attribute without success.

    The issue occurs both locally and when deployed on Azure.

    Has anyone else experienced this or might know something about the issue?

  • Adam Werner 21 posts 202 karma points MVP 2x c-trib
    Aug 18, 2020 @ 18:52
    Adam Werner
    100

    I went about installing a local instance of Umbraco 7.9.2 to try this out without the past experience I had with Umbraco 8.x where I was able to get this to work.

    The setup I'm sharing is one where I established a API key within SendGrid's administration site. I have also set this up through Azure's setup and there are some slightly different settings in that scenario.

    I was able to get this to work locally on IIS just now with the following settings in my web.config,

        <network host="smtp.sendgrid.net" 
                 userName="apikey" 
                 password="{{ SendGrid's generated key }}"
                 port="587"
                 enableSsl="false"
                 />
    

    I was surprised by the generic 'apikey' used as the userName, but that's what worked.

    I was able to get this to send successfully locally. I'm going to try and deploy this to Azure and see if this continues to work there as well.

  • Adam Werner 21 posts 202 karma points MVP 2x c-trib
    Aug 18, 2020 @ 19:16
    Adam Werner
    1

    I very quickly deployed to the Azure App service and the same settings worked as they did locally from the post above.

    Hopefully this will work out for you too!

    Please let me know if you went about establishing the SendGrid account information within the Azure Portal as there will be some slight differences when it comes to setting your userName and password settings.

  • Johan Andersson 2 posts 34 karma points
    Aug 19, 2020 @ 11:38
    Johan Andersson
    2

    Setting userName to apikey did the trick! Thanks a lot for your help!

    A virtual bouquet of flowers from our team: enter image description here

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies