How do I send SMTP email from third party app that has no authentication options, on an Azure VM

EddieB 70 Reputation points
2024-12-04T16:48:04.8766667+00:00

I understand that port 25 outbound is blocked on our Azure VMs.

I successfully set up and tested Azure Communication Service and Azure Email Communication Service. I also tested sendGrid. But all of these solutions require some sort of authentication.

The problem is, I have an older third-party application I want to run on my Azure Windows VM that has no options for sending authentication credentials. The app is currently running on an on-premise Windows VM, pointed directly to our Office365 mail server/connector with no issues.

I even considered setting up an SMTP relay server within our Azure environment, which could receive unauthenticated SMTP and then forward/relay the messages to our office365 server using SMTP AUTH (port 587) but I have not been able to find a viable solution for this either.

Is there any way to send unauthenticated SMTP from an Azure Windows VM?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,043 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2024-12-05T00:41:11.2166667+00:00

    Hi EddieB,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    Azure blocks outbound traffic on port 25 by default. Since your application doesn’t support authentication, you can configure an SMTP relay server on your Azure VM as a workaround. Follow these steps:

    • Deploy an SMTP relay server (e.g., hMailServer on Windows or Postfix on Linux) on the VM.
    • Configure the relay to forward emails to Office 365 using SMTP AUTH on port 587.
    • In Office 365, set up a connector to allow relay from the VM’s IP address.
      Set up connectors for secure mail flow.
    • Update the VM’s NSG to allow outbound traffic on port 587 to Office 365.

    For more details, please refer to the below documentation:
    Troubleshoot outbound SMTP connectivity problems in Azure

    If an answer has been helpful, please consider accept the answer and "Upvote" to help increase visibility of this question for other members of the Microsoft Q&A community. 

    User's image


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.