Hello Raizada, Atul,
Welcome to microsoft Q&A, thankyou for posting your query here.
Referring to the below documentation i would like to highlight some points here.
https://learn.microsoft.com/en-us/azure/virtual-network/troubleshoot-outbound-smtp-connectivity#recommended-method-of-sending-email
There is a possibility to use port 25 for outbound communication on Azure VMs, but there are some subscription limitations as mentioned below:
For VMs that are deployed in standard Enterprise Agreement subscriptions, the outbound SMTP connections on TCP port 25 will not be blocked.
For Enterprise Dev/Test subscriptions, port 25 is blocked by default. It is possible to have this block removed.
For all other subscription types, the Azure platform will block outbound SMTP connections on TCP port 25 for deployed VMs and this block cannot be removed. This includes Pay-as-you-go.
So, when using a other than standard-enterprise subscription , users are recommended to use an authenticated SMTP relay service to send email from Azure VMs through TCP port 587, or other ports because port 25 is blocked by default and this block cannot be removed.
There are various authenticated SMTP relay services available that support port 587.
One such service is SendGrid, but there are others.
https://www.twilio.com/docs/sendgrid/for-developers/partners/microsoft-azure-2021
SendGrid accepts unencrypted and TLS connections on ports 25, 587, & 2525, and you can also connect via SSL on port 465.
Refer: https://docs.sendgrid.com/for-developers/sending-email/getting-started-smtp#send-an-smtp-email-using-telnet
Hope this helps you.
If an answer has been helpful, please consider accepting the answer to help increase visibility of this question for other members of the Microsoft Q&A community. If not, please let us know what is still needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!