Error while talking to IMAP server

843 views
Skip to first unread message

Jungho Ahn

unread,
Apr 27, 2017, 2:23:42 PM4/27/17
to Repo and Gerrit Discussion
Hi,

I'm trying to set up receiveemail. My config is

[receiveemail]
        protocol = IMAP
        host = imap.gmail.com
        port = 993
        encryption = SSL
        username = xxxx
        password = yyyy

But I got the following exception.

[2017-04-27 11:19:36,707] [main] INFO  com.google.gerrit.pgm.Daemon : Gerrit Code Review 2.14 ready
[2017-04-27 11:19:45,266] [Timer-1] ERROR com.google.gerrit.server.mail.receive.ImapMailReceiver : Error while talking to IMAP server
java.io.EOFException: Connection closed without indication.
at org.apache.commons.net.imap.IMAP.__getReply(IMAP.java:151)
at org.apache.commons.net.imap.IMAP._connectAction_(IMAP.java:227)
at org.apache.commons.net.imap.IMAPSClient._connectAction_(IMAPSClient.java:175)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:189)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:209)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:306)
at com.google.gerrit.server.mail.receive.ImapMailReceiver.handleEmails(ImapMailReceiver.java:60)
at com.google.gerrit.server.mail.receive.MailReceiver$1.run(MailReceiver.java:89)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)

I tried to test with openssl

openssl s_client -crlf -connect imap.gmail.com:993
...
tag login xxxx yyyy
* CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH UTF8=ACCEPT LIST-EXTENDED LIST-STATUS LITERAL- SPECIAL-USE APPENDLIMIT=35651584
tag OK xxxx authenticated (Success)
tag LIST "" "*"
* LIST (\HasNoChildren) "/" "INBOX"
...

I got the same exception when I try to POP3.

Is there something wrong with my config?

Thanks,

Jungho Ahn

unread,
Apr 28, 2017, 12:20:18 PM4/28/17
to Repo and Gerrit Discussion
Did anyone have the same issue?
Given that the connection with openssl works fine, I think there is some issue in my config or receiveemail.

Patrick Hiesel

unread,
May 2, 2017, 3:01:55 AM5/2/17
to Repo and Gerrit Discussion
Hi!


If that doesn't work either, I can try to setup a test instance to see what the problem is. Though, we use Apache Commons to connect to the mail servers, so if there is an issue at this layer, it is likely that it's either a configuration problem or a problem with the mail server.

Thanks!
Patrick

Jungho Ahn

unread,
May 2, 2017, 5:26:59 AM5/2/17
to Patrick Hiesel, Repo and Gerrit Discussion
Hi Patrick,

Yes I tried TLS, but it didn't work either - same error message.

Thanks!

--
--
To unsubscribe, email repo-discuss+unsubscribe@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to a topic in the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/repo-discuss/vgpAa_uXXmo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to repo-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jungho

Jungho Ahn

unread,
May 5, 2017, 1:20:36 PM5/5/17
to Patrick Hiesel, Repo and Gerrit Discussion
Hi Patrick,

I'm just wondering if you have a chance to test and see what the problem is.
Thanks,
--
Jungho

Patrick Hiesel

unread,
May 8, 2017, 9:37:48 AM5/8/17
to Jungho Ahn, Repo and Gerrit Discussion
Hi Jungho,

I did and I was able to reproduce your error. Thanks for your report!

We did not use SSL/TLS implicitly (that means that the TLS command is executed right after the connection was established) which is required for Gmail. I've uploaded a fix here:


My config is (would be similar for IMAP then):

[receiveemail]
        protocol = POP3
        host = pop.gmail.com
        port = 995
        encryption = SSL
        username = omi...@gmail.com
        password = omitted

Hope that works for you.

Thanks!
Patrick


Patrick Hiesel

unread,
May 8, 2017, 9:55:28 AM5/8/17
to Jungho Ahn, Repo and Gerrit Discussion
... sorry I forgot to mention that for Gmail, you need to allow access from less secure apps for the account you want to access:


Thanks,
Patrick

Jungho Ahn

unread,
May 8, 2017, 2:26:06 PM5/8/17
to Patrick Hiesel, Repo and Gerrit Discussion
Cool! Thanks Patrick for fixing this.
Is this going to be in the next release like 2.14.1? 
--
Jungho

David Pursehouse

unread,
May 8, 2017, 7:20:53 PM5/8/17
to Jungho Ahn, Patrick Hiesel, Repo and Gerrit Discussion
On Tue, May 9, 2017 at 3:26 AM 'Jungho Ahn' via Repo and Gerrit Discussion <repo-d...@googlegroups.com> wrote:
Cool! Thanks Patrick for fixing this.
Is this going to be in the next release like 2.14.1? 


Yes, this fix will be in 2.14.1.

 

--
--
To unsubscribe, email repo-discuss...@googlegroups.com

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to a topic in the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/repo-discuss/vgpAa_uXXmo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to repo-discuss...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Jungho



--
Jungho





--
Jungho

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.

Jungho Ahn

unread,
Jun 19, 2017, 8:12:37 PM6/19/17
to David Pursehouse, Patrick Hiesel, Repo and Gerrit Discussion
Hi David,

I just upgraded to 2.14.1 and receiveemail seems to fetch emails well.
But I'm not sure how to enable it. When I reply from the change email, it replies to all reviewers not to gerrit server email.

Thanks,


--
--
To unsubscribe, email repo-discuss+unsubscribe@googlegroups.com

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to a topic in the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/repo-discuss/vgpAa_uXXmo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to repo-discuss+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Jungho



--
Jungho





--
Jungho

--
--
To unsubscribe, email repo-discuss+unsubscribe@googlegroups.com
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Jungho

Patrick Hiesel

unread,
Jun 20, 2017, 7:31:36 AM6/20/17
to Jungho Ahn, David Pursehouse, Repo and Gerrit Discussion
Hi Jungho,

I just upgraded to 2.14.1 and receiveemail seems to fetch emails well.

Great!

But I'm not sure how to enable it. When I reply from the change email, it replies to all reviewers not to gerrit server email.

There are multiple ways to do this. You can either set 'sendmail.from' to your inbound address if both inbound and outbound address are the same.

Alternatively you can set 'sendmail.replyToAddress' to your inbound address if your inbound and outbound address differ.

You can find details about those settings in the docs you have linked.

Hope that helps!

Patrick

Jungho Ahn

unread,
Jun 20, 2017, 1:26:32 PM6/20/17
to Patrick Hiesel, David Pursehouse, Repo and Gerrit Discussion
IIUC, there should be no need to set 'sendmail.from'  or  'sendmail.replyToAddress'.
'sendmail.from' is MIXED by default and it seems to work as expected.
'sendmail.replyToAddress' is empty by default, which adds 'sendemail.from' as Reply-To if inbound email is enabled.
But 'Reply-To' is set to all reviewers' and the author's emails. Did I misunderstand something?

Thanks,
--
Jungho

Patrick Hiesel

unread,
Jun 21, 2017, 9:48:06 AM6/21/17
to Jungho Ahn, David Pursehouse, Repo and Gerrit Discussion
Your explanation is correct. If you now set ''sendmail.replyToAddress' to the address at which Gerrit can receive emails, you should be good to go to just hit reply and send your comment.

IIRC by default we set Reply-To to all reviewers, but I thought there was some exception made for hosts that have inbound email enabled. Anyway, setting 'sendmail.replyToAddress' should do the trick.
Reply all
Reply to author
Forward
0 new messages