Issue 1498: Gerrit SMTP over SSL Fails to Authenticate
Status:  Released
Owner: ----
Closed:  Aug 27
Reported by oneprem...@gmail.com, Jul 27, 2012
Affected Version:2.4.2

What steps will reproduce the problem?

1.Setup gerrit config using sendemail settings, https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#_a_id_sendemail_a_section_sendemail

2.Provide an SMTP server capable of SSL over port 465.

3.Use the following settings;

[sendemail]
	enable = true
	smtpServer = smtp.domain.com
	smtpServerPort = 465
	smtpEncryption = ssl
	smtpUser = buildusr@domain.com
        smtpPass = XXXXXXXXX

Try with sslVerify true and false, either will fail.

Verify and test your settings using any known email client prior to setup.

What is the expected output? 

Email should send successfully when notifications are turned on for all comments in Settings or users added to changes.

What do you see instead?

[2012-07-26 12:36:13,631] INFO  com.google.gerrit.sshd.SshDaemon : Started Gerrit SSHD on *:29418
[2012-07-26 12:37:50,238] ERROR com.google.gerrit.server.patch.PublishComments : Cannot email comments for 15,2
com.google.gerrit.server.mail.EmailException: SMTP server rejected auth: 535 5.7.8 Error: authentication failed: authentication failure

	at com.google.gerrit.server.mail.SmtpEmailSender.open(SmtpEmailSender.java:255)
	at com.google.gerrit.server.mail.SmtpEmailSender.send(SmtpEmailSender.java:161)
	at com.google.gerrit.server.mail.OutgoingEmail.send(OutgoingEmail.java:125)
	at com.google.gerrit.server.patch.PublishComments$1.run(PublishComments.java:345)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at com.google.gerrit.server.util.RequestScopePropagator$1.call(RequestScopePropagator.java:86)
	at com.google.inject.servlet.ServletScopes$3.call(ServletScopes.java:194)
	at com.google.gerrit.server.util.RequestScopePropagator$2.call(RequestScopePropagator.java:96)
	at com.google.gerrit.server.util.RequestScopePropagator$4.run(RequestScopePropagator.java:161)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
	at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:333)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
[2012-07-26 17:19:28,320] INFO  com.google.gerrit.sshd.SshDaemon : Stopped Gerrit SSHD

Please provide any additional information below.

I've tried using two different smtp servers, both which support ssl over port 465. The credentials i'm using work for other services in our infrastructure.

I've also tried gmail as a test and encounter a slightly different error:

SMTP server rejected auth: 535-5.7.1 Username and Password not accepted. Learn more at

535 5.7.1 http://support.google.com/mail/bin/answer.py?answer=14257 s7sm1708849oec.7
Aug 30, 2012
#1 nigel.ma...@gmail.com
Same behaviour here -- the Jenkins mail plugin works however.

Sep 2, 2013
#2 tarunkum...@gmail.com
Has anybody found the solution of this problem....I am facing the exact same issue. Appreciating in advance!!!

Thanks
Tarun
Mar 30, 2014
#3 zwci...@gmail.com
same problem, waiting for solution
May 12, 2014
#4 kokomi...@gmail.com
Same exact issue still present in latest 2.8.5 release. Creds are valid as they work correctly for Jenkins. 
May 13, 2014
#6 asur...@gmail.com
same problem 2 years later
May 13, 2014
Project Member #7 edwin.ke...@gmail.com
> same problem 2 years later
No contribution since two years...
Aug 27, 2015
Project Member #9 dougk....@gmail.com
Tested this last night and found it to be working on master.  My configuration (sanitized):

gerrit.config:
[sendemail]
        smtpServer = smtp.gmail.com
        smtpEncryption = ssl
        smtpUser = me@gmail.com

secure.config:
[sendemail]
        smtpUser = appSpecificPassword

I have two-factor auth enabled, so I had to generate an app-specific password.
Aug 27, 2015
Project Member #10 bklarson@gmail.com
Doug K tells me this can be marked resolved - doing so on his behalf.
Status: Released
Labels: FixedIn-2.12
Nov 26, 2015
Project Member #11 david.pu...@sonymobile.com
Any idea which commit fixed this?
Status: Submitted
Dec 21, 2015
Project Member #12 david.pu...@sonymobile.com
(No comment was entered for this change.)
Status: Released