Forum Discussion
JernejP
Jul 15, 2020Microsoft
Using 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...
JernejP
Microsoft
Hi ShellBlazer
This gives me the following error:
Exception calling "Send" with "1" argument(s): "Failure sending mail."
At C:\Smail2.ps1:33 char:1
+ $Smtp.Send($Message)
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : SmtpException
ShellBlazer
Jul 16, 2020Brass Contributor
You can verify if the port is open with telnet.
In windows 10 telnet is not by default available.
1. You can do this with Putty:
=>
220 AM0PR06CA0073.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 16 Jul 2020 06:47:41 +0000
2. Use the telnet command in WSL (subsystem for linux).
telnet smtp.office365.com 587
Trying 40.101.81.162...
Connected to ams-efz.ms-acdc.office.com.
Escape character is '^]'.
220 AM0PR06CA0118.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 16 Jul 2020 06:44:07 +0000
If connection is not working, you probably have to look at the outbound connection first. And than my first guess is Firewall, second Policy. And maybe this connection attempt will get you a more descriptive error.