jakartaee / jakartaee/mail-api
java.lang.NumberFormatException: For input string: "CAPABILITY" is being thrown when try to connect imap store
- Dominant language
- Java
- Stars
- 285
- Forks
- 109
- Avg merge
- 15h 19m
- Merged PRs (30d)
- 1
Description
**Describe the bug**
Unable to connect to imap store with imap.gmail.com host. it always throws java.lang.NumberFormatException: For input string: "CAPABILITY" , when try to connect imap store.
**To Reproduce**
1. execute this peice of code
host = imap.gmail.com, email = your gmail where app password is created, appPassword = app password created in gmail
Properties properties = new Properties();
properties.put("mail.imap.host", host);
properties.put("mail.imap.port", "993");
properties.put("mail.imap.ssl.enable", "true");
properties.put("mail.debug", "true");
properties.put("mail.imap.enablecapability", "false");
Session emailSession = Session.getDefaultInstance(properties);
Store store = emailSession.getStore("imap");
store.connect(host, email, appPassword);
**Expected behavior**
1. should successfully connect with store and return store instance to perform furthur action like read Inbox etc
**Screenshots**

**Desktop (please complete the following information):**
- OS: Window 11
- Browser: Chrome
- Version Version 131.0.6778.205
-
**Smartphone (please complete the following information):**
N/A
**Mail server:**
- Protocol being used: imap
- Vendor/product: [e.g. Microsoft Exchange]
- Mail service URL: imap.gmail.com
**Additional context**
Add any other context about the problem here.
Contributor guide
Research direction
No source file or test is named. Start by running the provided Java reproduction with imap.gmail.com and mail.debug enabled, then inspect the connection trace around the CAPABILITY response. Done means the same configuration connects successfully and returns a usable Store without NumberFormatException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100