Make sure you are using TLS1.2, and if that's not an option use the legacy endpoint: https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/opt-in-exchange-online-endpoint-for-legacy-tls-using-smtp-auth
Also make sure the account you're authenticating with is properly licensed and enabled for SMTP auth: https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/authenticated-client-smtp-submission
The response from the remote server was

IT Operation Manager
1
Reputation point
Dear Reader,
I'm facing issue sometime with SMTP of office 365. it's giving The response from the remote server was: 334. It's been around 1 month, we are facing this issue.
Please advise the permanent fix for this.
Regards
Dinesh Kumar
{count} votes
1 answer
Sort by: Most helpful
-
Vasil Michev 67,366 Reputation points MVP
2022-09-03T07:01:04.99+00:00