Nov 28 2022 03:02 PM
I am trying to send a mail message using Power Shell
I am using the following script:
$credential = Get-Credential
$mailParams = @{
SmtpServer = 'smtp.office365.com'
Port = '587' # or '25' if not using TLS
UseSSL = $true ## or not if using non-TLS
Credential = $credential
From = 'email address removed for privacy reasons'
To = 'email address removed for privacy reasons'
Subject = "SMTP Client Submission - $(Get-Date -Format g)"
Body = 'This is a test email using SMTP Client Submission'
DeliveryNotificationOption = 'OnFailure', 'OnSuccess'
}
## Send the message
Send-MailMessage @mailParams
The credentials are entered in a dialog box and are my email and password which I have verified. The email box has Authenticated SMPT checked.
This is the error message I get. Any suggestions?
Send-MailMessage: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 Client not authenticated to send mail. Error: 535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [CH0P221CA0037.NAMP221.PROD.OUTLOOK.COM]
Nov 28 2022 06:31 PM
SolutionPlease check security defaults or MFA was enabled for your tenant and mailbox?
Apr 09 2023 08:56 AM
Apr 09 2023 04:22 PM
Nov 28 2022 06:31 PM
SolutionPlease check security defaults or MFA was enabled for your tenant and mailbox?