Situation: I have migrated my company's email over to Microsoft Exchange. As such I have been familiarizing myself with Powershell, because I want to be able to script the process of adding users.
What I want to do*: After creating a new user I want to notify the new user's supervisor of the username and password they are to use. Ideally, I want to BCC myself so I have confirmation of the new user(s) and credentials as well as exclusively using the command line.
The problem: When testing out the Send-MailMessage
cmdlet in Powershell I get the following error:
WARNING: The command 'Send-MailMessage' is obsolete. This cmdlet does not guarantee secure connections to SMTP servers. While there is no immediate replacement available in PowerShell, we recommend you do not use Send-MailMessage at this time. See https://aka.ms/SendMailMessage for more information.
Send-MailMessage: Error in processing. The server response was: Requested action aborted: local error in processing
My question(s):
I tried using the following test script:
Send-MailMessage `
-From "myemail@domain.tld" `
-To "mycoworkeremail@domain.tld" `
-SmtpServer "outlook.office365.com" `
-Subject "Test Email" `
-Body "Test message"
This has been answered here:
PowerShell send-mailmessage deprecated - future consequences for people still relying on it?
Essentially Microsoft has deprecated the feature.