I tried the following
send-mailmessage -subject "hi" -to "abc@abc.com" -from "abc@abc.com" -UseSsl -SmtpServer "smtp.office365.com" -port 25 -Credential (Get-Credential)
I even tried with different ports but it is throwing the below exception
send-mailmessage : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [XXXXXXXXXXX.YYYYYY.PROD.OUTLOOK.COM]
then I even tried System.Net.Mail.SmtpClient:SmtpClient
method but even this is throwing the same error