we have the following configuration 1) a simple c# code for sending mails using the smtp client in a linux container 2) smtp relay is configured using sendgrid 3) deploy this in azure appservices, everything is as expected, we are receving emails without any issues
however the same in Azure kubernetes services is not able to send an email and we see the following in our logs
Failed to send e-mail notification using SMTP because some error occured : System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: The connection was closed.
From what we understand of the problem, AKS is preventing this as the same code is working as expected in azure appservice, are there any specific ports or configuration that we need to the cluster or pod level ? we tried allowing 597 port in the default NSG that AKS creates without any luck.
Thanks
As mentioned by you in the comments section above, I'm converting this to an answer which may help other community members.
After changing the configuration in the helm chart from "api" to "apikey" in the smtp username, your issue got resolved.