I am trying to use AWS SES in my .net core (.net 6 ) web app, when I run the code locally and send an email it works fine and the email is sent successfully. however after deployment to Azure App Services (basic plan) it doesn’t work and no error is displayed. it just doesnt send the email.
Things I tried to do:
1- first I was using App Service Vnet Integration to secure my connection to my SQL database. I tried to use it with "all routing" option enabled and disabled and it still doesn’t work.
I deployed a NAT gateway in the Integration subnet, but nothing seems to work.
2- I removed the Vnet integration but still didn’t get any result.
3- I hardcoded my AWS SES credential in my code and redeployed but that didn’t help
anyone has any idea what I should do ?
thank you
2
Answers
I was able to solve this issue. The problem wasn't related to AWS SES at all.
When I send an email, I read an HTML file that contains the email template and fill it with customized data.
The file structure in the Azure app service is different that the file structure in the local environment; hence, my code wasn't able to locate the template. All I had to do was place the template in my wwwroot folder and modify the paths in my code, and now everything works fine.
As I know, outbound SMTP connectivity (port 25) is supported for App Service when the SMTP traffic is routed through the virtual network integration.
So the root cause related to the security port (like 25 and 587)
Suggestions
Since I don’t have AWS subscription, and I don’t know how to intergrate aws ses with azure app service, you could follow the troubleshoot docs to check it.
And I suggest you check the Recommended method of sending email. I also find this content below about the messaging service on Azure and AWS. I am not sure does it means not support AWS SES in Azure or not. For more details, you could raise a support ticket for Azure and AWS.