jakartaee / jakartaee/mail-api

Connection to Mail via Imaps protocol behind Http Proxy Server (which does not have authentication means no user/password) gives Http 403 error

Open
#478 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
285
Forks
109
Avg merge
15h 19m
Merged PRs (30d)
1

Description

**Describe the bug**
Connection Mail via Imaps protocol behind Http Proxy Server (which have not authentication means no user/password) gives Http 403 error

Tried with Gmail and Microsoft connection.

Giving parameters correctly

mail.imaps.proxy.host
mail.imaps.proxy.port

Just to mention when I use auth proxy it works fine (also give user and password in that case) but it fails for proxy which is non authenticated and when I dont supply user and password

mail.imaps.proxy.user
mail.imaps.proxy.password.

**To Reproduce**
Steps to reproduce the behavior:
1. User 1.6.2 javax mail jar
2. try to connect to a http proxy sever which is not using authentication (Used AWS Proxy in my case)
3. Provide : mail.imaps.proxy.host
mail.imaps.proxy.port
4. Http 403 comes
---------------------------
com.sun.mail.util.MailConnectException: Couldn't connect to host, port: imap.gmail.com, 993; timeout -1; Using web proxy host, port: ec2-************.us-west-2.compute.amazonaws.com, 3128;
nested exception is:
java.net.ConnectException: connection through proxy ec2-************.us-west-2.compute.amazonaws.com:3128 to imap.gmail.com:993 failed: HTTP/1.1 403 Forbidden
-------------------------------------------------------------
**Expected behavior**
Connection t mail should be established to read the mails and send the mails

**Screenshots**
If applicable, add screenshots to help explain your problem.
![image](https://user-images.githubusercontent.com/44771273/92330148-5aef3280-f08a-11ea-899c-24522a93b69a.png)

**Desktop (please complete the following information):**
- OS: Windows 10

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Mail server:**
- Protocol being used: imaps, smtp
- Vendor/product: Google , Microsoft Exchange
- Mail service URL: imap.gmail.com

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Begin by reproducing the IMAPS connection with JavaMail 1.6.2, the mail.imaps.proxy.host and mail.imaps.proxy.port settings, and an unauthenticated HTTP proxy. Compare the result with an authenticated proxy using Gmail or Microsoft Exchange; done means the unauthenticated proxy establishes the mail connection without the HTTP 403 error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.