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...
ShellBlazer
Jul 15, 2020Brass Contributor
Not familiar with the error message. Could be al sort of things.
What you could check:
1. Is SMTP not blocked? (Firewall/policy)
2. No policy that blocks basic auth?
Have you tried the following code:
# Sender and Recipient Info $MailFrom = "sender@senderdomain.com" $MailTo = "recipient@recipientdomain.com" # Sender Credentials $Username = "SomeUsername@SomeDomain.com" $Password = "SomePassword" # Server Info $SmtpServer = "smtp.domain.com" $SmtpPort = "2525" # Message stuff $MessageSubject = "Live your best life now" $Message = New-Object System.Net.Mail.MailMessage $MailFrom,$MailTo $Message.IsBodyHTML = $true $Message.Subject = $MessageSubject $Message.Body = @' <!DOCTYPE html> <html> <head> </head> <body> This is a test message to trigger an ETR. </body> </html> '@ # Construct the SMTP client object, credentials, and send $Smtp = New-Object Net.Mail.SmtpClient($SmtpServer,$SmtpPort) $Smtp.EnableSsl = $true $Smtp.Credentials = New-Object System.Net.NetworkCredential($Username,$Password) $Smtp.Send($Message)
ShellBlazer
Jul 15, 2020Brass Contributor
As for the exchange online sending limits:
You can read up in more details in the docs pages: