Forum Discussion
JernejP
Microsoft
Jul 15, 2020Using PowerShell to create 15k accounts and email account data
Hi,
We have a project where we will have to create 15000 new user accounts. I will get the information for the users (such as first name, last name, and email address where to send account info...
Ja4ed
Jul 16, 2020Copper Contributor
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.
- JernejPJul 16, 2020
Microsoft
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.