Trouble Using GMAIL as SMTP server

I just upgraded from 4.5 to because I thought that might solve my issue, but it has not so I am looking for advice.

Gmail settings are correct - I would go through periods where I would get emails and then it would stop again before. SMTP is on, less secure apps, etc. etc.

I get the following error when trying to validate the connection

Verification of mail server [] failed: 
can't connect to mail server, authentication settings are invalid

and this error in the tasks section of the admin 535 Incorrect authentication data lucee.runtime.exp.NativeException: 535 Incorrect authentication data at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate( at com.sun.mail.smtp.SMTPTransport.authenticate( at com.sun.mail.smtp.SMTPTransport.protocolConnect( at javax.mail.Service.connect( at Caused by: javax.mail.AuthenticationFailedException: 535 Incorrect authentication data ... 5 more :0 535 Incorrect authentication data

I am 100% sure the username/password is correct and working. I can easily login to gmail itself. Anybody have any ideas? Firewall issue or something? Appreciate any feedback

Hi @Ryan_Crutchfield,

Gmail can access via
// TLS enabled
port = 587
//SSL enabled
Port = 465

Please ensure that did you using above ports or paste your code here?

1 Like

I am using the GMAIL connector in the server admin, but here is the code output it displays

this.mailservers =[ {
	  host: ''
	, port: 587
	, username: 'XXXXX'
	, password: 'XXXXX'
	, ssl: false
	, tls: true
	, lifeTimespan: createTimeSpan(0,0,1,0)
	, idleTimespan: createTimeSpan(0,0,0,10)

Do you have 2FA enabled? If so, you should be using an app specific

If not, you probably should be using it. :slight_smile:

Do you use the same gmail address in the from field? If you use a different address then you might get this error.

Also, if you have a g-suite account then use their tech-support. They have great tools that give useful information when something fails.

Another thing I can think of is that you’ve reached hourly or daily limits. Their limits are rather low even for g-suite accounts, so I had to modify my code to use Amazon’s service instead of google’s.

Thanks - I think it is a server issue somewhere - possibly in the firewall. I tried a totally different email server and have the same issue. Thanks again.

Ah, nice! Thanks for this tip. I had to enable the app-specific password for a similar error.

Welcome to @bennadel!