0

I am trying to resolve the issues around Azure and sending emails via Office 365 SMTP Relay (Connector), but the help online doesn't resolve the problem.

I have a PowerShell System setup on Azure which does automatic tasks. The system now sends emails afterwards in case of success or errors. Currently we are using our old mail provider which works fine. I update the send-mailmessage(even with the new Mailozaurr module) information to our SMTP Relay and works without issues from my local PC.

Now deploying the script on the AZURE VM it doesn't work. The "firewall" - Wherever I can manage that on Azure - seems to block port 25. None of the other standard ports work. Considered moving the VM to our AWS instance, as they don't seem to tell the Admin what they can and cannot do on their own VM.

How do I get my VM to send Emails via port 25 without further costs involved.

Dave M
  • 4,514
  • 22
  • 31
  • 30
  • There's some helpful detail of the various options open to you here: https://adamtheautomator.com/azure-send-email/ – JohnLBevan Mar 12 '21 at 12:55

1 Answers1

1

Outbound SMTP traffic on port 25 is blocked as documented here. You should be using authenticated SMTP on port 587 or 443.

Sam Cogan
  • 38,736
  • 6
  • 78
  • 114
  • I guess they want you to pay for yet another service besides your own VM and your own Office Subscription. I take it I cannot setup a Connector with Authenticated, right? Do I need a "exchange licence" with a tech user? - I guess thats what I deserve trusting the cloud :) – stackoverflow1338 Jan 11 '21 at 13:56
  • There’s nothing additional to pay for here if your already using office 365 mail, you just need to configure your client to to use the right port and authentication. – Sam Cogan Jan 11 '21 at 13:58
  • Well but I would need some sort of Exchange Mailbox and User account for it, right? The Relay doesnt need a user account or exchange mailbox (Licence) I dont want to use my private account Information on a company Script. Let me try with some technical User without Mailbox attached – stackoverflow1338 Jan 14 '21 at 14:27
  • You will not be able to use Office 365 to relay mail without an account regardless of what port you use. Microsoft aren't providing a free open relay. – Sam Cogan Jan 14 '21 at 14:29
  • They provide that on your own Exchange Online server. I cant set it up and Whitelisted IPs can Relay SMTP on Port 25. No need to exchange Online account to be linked with the call. Now I have to create a user account, setup an exchange mailbox (Licence needed) register the Send-mailmessage with the credentials and make sure the domain it uses to send is actually linked to the Office365 acccount, otherwise SMTP Authenticated doesnt allow to send it. – stackoverflow1338 Jan 14 '21 at 15:54
  • The SMTP relay can send just any domain name. As long as my SPF records are correct I dont even get flagged as Spam: https://poweraddon.com/how-to-configure-an-office-365-to-receive-emails-from-an-external-smtp-server/ no issues to run any Powershell script on my AWS or Local PC just using that.. on port 25! .. Azure VM does not allow it unless you have a number of Invoices over 1000$ or your licence is older than 2017. – stackoverflow1338 Jan 14 '21 at 15:54
  • Your very much confusing this issue. Yes if you have your own exchange server you can use it as a relay, but you have bought and paid for that. You can still do that right now with no extra cost, just use port 587/443. If you want to use Exchange Online/ Office 365 then you have to pay for it, Microsoft aren't giving it away. You can also look at using something like SendGrid which as a free tier. Microsoft have chosen to ban traffic on port 25 from Azure, you either need to use a service to send mail that operates on a support Azure port, or don't use Azure – Sam Cogan Jan 14 '21 at 15:56