Mail server Error (Login denied(ec=67)

I’ve looked through these forums and followed the set-up of others.
I’ve tried the following settings
Mailserver: smtp.gmail.com/smtp.office365.com
Mail server port: 587
Mail server username: sending email address
Mail server password: sending email address password
Tried every combination of boxes checked but generally check: Send mails only with SSL/TLS and Check SSL/TLS certificate
Server admin email address: sending email address
Send test mail to this email address: receiving email address

I feel like the login is getting blocked by 365 and gmail, although I’m not sure how to fix it. In gmail I turned on the setting to allow 3rd party apps and I allowed logins from the device. Any help would be appreciated.