Trouble Using GMAIL as SMTP server


#1

I just upgraded from 4.5 to 5.2.4.37 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 [smtp.gmail.com] failed: 
can't connect to mail server, authentication settings are invalid

and this error in the tasks section of the admin

smtp.gmail.com 535 Incorrect authentication data lucee.runtime.exp.NativeException: 535 Incorrect authentication data at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:826) at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:761) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:685) at javax.mail.Service.connect(Service.java:317) at lucee.runtime.net.smtp.SMTPSender.run(SMTPSender.java:65) Caused by: javax.mail.AuthenticationFailedException: 535 Incorrect authentication data ... 5 more :0
smtp.gmail.com 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


#2

Hi @Ryan_Crutchfield,

Gmail can access via
server: smtp.gmail.com
// TLS enabled
port = 587
//SSL enabled
Port = 465

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


#3

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

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

#4

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

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


#5

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.


#6

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.