Trying to Send SMTP via an HVE account comes up with the following error :
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. Contact your administrator.
At C:\Scripts\SMTP.ps1:10 char:1
- Send-MailMessage -From [email protected] -To [email protected] …
~~~~~~~~~~~~~~~~~- CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-Mai
lMessage], SmtpException - FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage
- CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-Mai
Make sure you whitelist the account from Any Conditonal Access Policies that block basic Auth or MFA
If your MFA policy allows via Trusted IPs then you are good
Create an Authentication Policy that allows Basic SMTP
Get-AuthenticationPolicy | Select Identity
Get-OrganizationConfig | Select DefaultAuthenticationPolicy
New-AuthenticationPolicy BasicAllowSMTP -AllowBasicAuthSmtp
Set-User -Identity "[email protected]" -AuthenticationPolicy "BasicAllowSMTP"