Forum Discussion
Using PowerShell to create 15k accounts and email account data
You sure 'smtp.office365.com' is the correct SmtpServer?
I got the exact same error message using that SmtpServer with an on-prem Exchange mailbox for the Credential and From parameters.
Ja4ed - You're right, I checked the domain's MX records and saw that it's an on-prem server (mail.thedomain.com), and when I tried telnet, I get an error "Could not open connection to the host, on port 25: Connect failed". The same happens for port 587.
How would I go about debugging this? To see why it doesn't connect? Whereas telnet to smtp.office365.com works fine.
- ShellBlazerJul 16, 2020Brass Contributor
I don't think you can use smtp.office365.com as outgoing server unless the user has has a mailbox and/or license in exchange online. If the mailbox is on-premises, than use the on-prem exchange to send. But chances are security has made this impossible by blocking this kind of traffic in the firewall. It is a best practice to protect your exchange infrastructure from being used as a relay for spamming ppl.