unable to send mail using SMTP Mail Server

I am using suiteCRM and trying to send mails. but when i enter the correct credentials of my email and port and SMTP server details as well the CRM pops up an error as “An email error occurred:SMTP Error: Could not authenticate” even on the test mail.

How do i resolve this error, I’m stuck here and could not find any solution.
Please Help!

Thanks!

Which version are you using?

There are several places in SuiteCRM where you configure email accounts. Exactly which one are you trying?

Can you send the test email? If it fails, do you see a link to “view full STMP log”?

If you’re using a Gmail account, make sure you select “allow less secure apps” in your Google account.

I fixed using Google Account App passwords
This person explain well to generate app password and use this one instead of your real password
https://youtu.be/4TmD4ly7V_E?t=166

Then I updated all below
SuiteCRM \ Outgoing Mail Configuration \ Email Settings
SMTP Mail Server: smtp.gmail.com
SMTP Port: 587
Use SMTP Authentication: check
Enable SMTP over SSL or TLS: TLS check
Gmail Email Address: myemail@gmail.com
Gmail Password: *** *** use the one from Google Account App passwords
Users may send as this account’s identity check

PHP.INI
    [mail function]
        SMTP=smtp.gmail.com
        smtp_port=587
        sendmail_from = myemail@gmail.com
        sendmail_path = "d:\xampp\sendmail\sendmail.exe -t"

TO TEST EMAIL USING ANOTHER SMAPP APP USING XAMPP EMAIL
MANUAL TEST CONFIGURATION TO SEE IF YOU CAN OUTPUT EMAILS
D:\xampp\sendmail\sendmail.ini
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=tls
error_logfile=error.log
debug_logfile=debug.log
auth_username=myemail@gmail.com
auth_password=vkaz kfhe qdze msnw
force_sender=myemail@gmail.com
force_recipient=myemail@gmail.com
hostname=
***where auth_password is the Google Account App passwords

MANUAL TEST
pushd in cmd to D:\xampp\sendmail
@ECHO OFF
REM send email from command line via SMTP with sendmail
ECHO From: myemail@gmail.com > %TEMP%\temp.mail
ECHO To: myemail@gmail.com >> %TEMP%\temp.mail
ECHO Subject: this is a test >> %TEMP%\temp.mail
ECHO.>> %TEMP%\temp.mail
ECHO testing. >> %TEMP%\temp.mail
ECHO blah blah… >> %TEMP%\temp.mail
ECHO.>> %TEMP%\temp.mail
ECHO blah. >> %TEMP%\temp.mail
sendmail -t < %TEMP%\temp.mail
DEL %TEMP%\temp.mail
**