SOLVED

Using SendGrid from App Service with a VNet

Copper Contributor

We have an App Service that sends emails through SendGrid (on smtp.sendgrid.net). Recently we needed to attach a VNet to the App Service and have discovered that when we do this, emails aren't being sent. We see an "Unable to connect to the remote server" error in our logs.

 

Is there some kind of trick to getting SendGrid to work when a VNet is attached to an App Service?

1 Reply
best response confirmed by MikeNewton (Copper Contributor)
Solution

It turned out that Azure doesn't block port 25 from an App Service when it has no VNet attached. But as soon as you attach a VNet it blocks the port. The fix was to use an alternate port (like 587). After changing the port our app can again send emails.

1 best response

Accepted Solutions
best response confirmed by MikeNewton (Copper Contributor)
Solution

It turned out that Azure doesn't block port 25 from an App Service when it has no VNet attached. But as soon as you attach a VNet it blocks the port. The fix was to use an alternate port (like 587). After changing the port our app can again send emails.

View solution in original post