Azure Linux VM - sending mail using postfix or other

mmac 71 Reputation points
2022-07-15T16:38:24.603+00:00

Trying to send email out to our internal users only from an Azure VM (Linux CentOS7), we have basic Azure tenant. Pay as you go servers.

Linux server is bound and getting usernames\groups from Azure Domain Services server.
I monitor various aspects and need to have emails sent out from the Linux server to our Office365 users (email)
I have our MX record and port 25 for our Exchange online email server details

Would like - use postfix on Linux server to send to our Exchange server and internal domain users only
What is best way to accomplish this? I read sendgrid would work as a 'smarthost', I would prefer to go directly from Linux server to Exchange (online)

I read Microsoft blocks port 25 by default and you have to request? We do not have a support subscription, is one needed to make this request?

Thank you!

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,707 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,714 questions
{count} vote

3 answers

Sort by: Most helpful
  1. Dillon Silzer 57,711 Reputation points
    2022-07-15T16:43:40.857+00:00

    Hello @MikeMacNeil-5031

    It is recommended that you use authenticated SMTP (port 587) to sendmail from an Azure VM (SendGrid is one of the recommendations they make to use). If you have an enterprise subscription then you will have access to raising a ticket with Microsoft as seen in the document below.

    For more information please read the documentation on https://learn.microsoft.com/en-us/azure/virtual-network/troubleshoot-outbound-smtp-connectivity

    221156-image.png

    221211-image.png

    ---------------------------

    If this helps please mark as correct answer.

    2 people found this answer helpful.
    0 comments No comments

  2. Chris Cant 6 Reputation points
    2022-12-09T19:17:21.037+00:00

    Postfix can be set up to send authenticated SMTP, eg in /etc/postfix/main.cf

    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = static:USERNAME:PASSWORD
    smtp_sasl_security_options = noanonymous
    smtp_tls_security_level = encrypt

    relayhost = [198.51.100.10]:587

    You can use an IP address or hostname within the square brackets.
    Make sure that your ufw and Azure outbound port rules allow the connection - which they may do by default

    See here:

    1 person found this answer helpful.
    0 comments No comments

  3. mmac 71 Reputation points
    2022-07-15T17:00:57.19+00:00

    Thank you, yes I read all of that and referrenced some of it in my question. Looking to see if anyone has something more creative or a better answer.

    0 comments No comments

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.