markmclaren / java-gmail-imap

Automatically exported from code.google.com/p/java-gmail-imap
0 stars 0 forks source link

Cannot connect to gmail #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've installed the latest version of you great lib in my code and want to 
connect to my gmail account. I have to have mail.jar in my code for others 
features and use your code for gmail access.

But it doesn't work correctly, I can't create an IMAPStore for gmail.

The problem is due to incorrect classname in provider creation. Your code is 
using javax.mail.Session for example instead of 
com.google.code.javax.mail.Session.

Here's the patch I've done to fix this problem. Note that I've only checked 
that patch for email retriving (with google id) on IMAP (with TLS or SSL) but 
no other function.

When could you release a new version of your lib with that patch (or a better 
one) ?

Regards,

Ludovic SMADJA

### Eclipse Workspace Patch 1.0
#P java-gmail-ext
Index: src/main/java/com/google/code/com/sun/mail/handlers/multipart_mixed.java
===================================================================
--- 
src/main/java/com/google/code/com/sun/mail/handlers/multipart_mixed.java    (revisi
on 9)
+++ 
src/main/java/com/google/code/com/sun/mail/handlers/multipart_mixed.java    (workin
g copy)
@@ -49,7 +49,7 @@

 public class multipart_mixed implements DataContentHandler {
     private ActivationDataFlavor myDF = new ActivationDataFlavor(
-       javax.mail.internet.MimeMultipart.class,
+       MimeMultipart.class,
        "multipart/mixed", 
        "Multipart");

Index: src/main/java/com/google/code/javax/mail/Session.java
===================================================================
--- src/main/java/com/google/code/javax/mail/Session.java   (revision 9)
+++ src/main/java/com/google/code/javax/mail/Session.java   (working copy)
@@ -787,7 +787,7 @@

    // construct an instance of the class
    try {
-       Class[] c = {javax.mail.Session.class, javax.mail.URLName.class};
+       Class[] c = {Session.class, URLName.class};
        Constructor cons = serviceClass.getConstructor(c);

        Object[] o = {this, url};
Index: src/main/java/com/google/code/com/sun/mail/handlers/message_rfc822.java
===================================================================
--- 
src/main/java/com/google/code/com/sun/mail/handlers/message_rfc822.java (revisio
n 9)
+++ 
src/main/java/com/google/code/com/sun/mail/handlers/message_rfc822.java (working
 copy)
@@ -56,7 +56,7 @@
 public class message_rfc822 implements DataContentHandler {

     ActivationDataFlavor ourDataFlavor = new ActivationDataFlavor(
-   javax.mail.Message.class,
+   Message.class,
    "message/rfc822", 
    "Message");

Index: src/main/java/com/google/code/com/sun/mail/pop3/POP3Store.java
===================================================================
--- src/main/java/com/google/code/com/sun/mail/pop3/POP3Store.java  (revision 9)
+++ src/main/java/com/google/code/com/sun/mail/pop3/POP3Store.java  (working 
copy)
@@ -153,7 +153,7 @@
            messageClass = Class.forName(s);
        }

-       Class[] c = {javax.mail.Folder.class, int.class};
+       Class[] c = {Folder.class, int.class};
        messageConstructor = messageClass.getConstructor(c);
        } catch (Exception ex) {
        if (debug)

Original issue reported on code.google.com by ludovic....@gmail.com on 1 Sep 2011 at 3:33

GoogleCodeExporter commented 9 years ago
Many Thanks Ludovic, 

I will incorporate your changes in the next version.

Best wishes,

Mark

Original comment by mark.mcl...@gmail.com on 22 Sep 2011 at 10:41

GoogleCodeExporter commented 9 years ago
Did you have a delay for the new version ? It's only to include the new jar in 
my code instead of patched one.

Ludovic

Original comment by ludovic....@gmail.com on 22 Sep 2011 at 12:27

GoogleCodeExporter commented 9 years ago

Original comment by mark.mcl...@gmail.com on 22 Sep 2011 at 9:26

GoogleCodeExporter commented 9 years ago
I have applied your fixes and the new version is now:

java-gmail-imap-1.4.4-gm-ext-0.1.jar

Many Thanks, Mark

Original comment by mark.mcl...@gmail.com on 22 Sep 2011 at 9:44

GoogleCodeExporter commented 9 years ago
I meant to ask, would you like to be officially recognised as a project 
contributor on the site's front page?

Original comment by mark.mcl...@gmail.com on 22 Sep 2011 at 10:14