PlanetJava
Custom Search

java-sun-javamail-general
[Top] [All Lists]

AW: javax.mail.MessagingException: Failed to load IMAP envelope

Subject: AW: javax.mail.MessagingException: Failed to load IMAP envelope
Date: Wed, 22 Oct 2008 11:40:32 +0200
Dear Bill,
thank you very much for your quick response. We are running the same
version of JavaMail on all machines - and the machines are using the
same JRE, however on different operation systems (Linux on the one hand,
Windows XP on the other). And all machines are talking to the same mail
server and the application is running on all machines as a
standalone-application.
However, you asked for the beginning of the DEBUG output - on the
"faulty" machines, the beginning looks like this:
Loading javamail.default.providers from
jar:file:/media/hda6/data/workspace-soknos/shared/extlibs/mail.jar!/META
-INF/javamail.default.providers
DEBUG: loading new provider protocol=imap,
className=com.sun.mail.imap.IMAPStore, vendor=Sun Microsystems, Inc,
version=null
DEBUG: loading new provider protocol=imaps,
className=com.sun.mail.imap.IMAPSSLStore, vendor=Sun Microsystems, Inc,
version=null
DEBUG: loading new provider protocol=smtp,
className=com.sun.mail.smtp.SMTPTransport, vendor=Sun Microsystems, Inc,
version=null
DEBUG: loading new provider protocol=smtps,
className=com.sun.mail.smtp.SMTPSSLTransport, vendor=Sun Microsystems,
Inc, version=null
DEBUG: loading new provider protocol=pop3,
className=com.sun.mail.pop3.POP3Store, vendor=Sun Microsystems, Inc,
version=null
DEBUG: loading new provider protocol=pop3s,
className=com.sun.mail.pop3.POP3SSLStore, vendor=Sun Microsystems, Inc,
version=null
DEBUG: getProvider() returning provider protocol=imap;
[email protected];
class=com.sun.mail.imap.IMAPStore; vendor=Sun Microsystems, Inc
DEBUG: mail.imap.fetchsize: 16384
DEBUG: protocolConnect returning false,
host=mailserver.kom.e-technik.tu-darmstadt.de,
[email protected], password=<null>
On my machine, it is "only":
DEBUG: setDebug: JavaMail version 1.4.1
DEBUG: getProvider() returning
javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun
Microsystems, Inc]
DEBUG: mail.imap.fetchsize: 16384
DEBUG: protocolConnect returning false,
host=mailserver.kom.e-technik.tu-darmstadt.de,
[email protected], password=<null>
This is really weird - as you can see, in the first console snippet, it
does not even say something like "setDebug: JavaMail version 1.4.1". And
there, the default providers are loaded, while on my machine, the right
provider is loaded immediately.
Regards
Stefan
Stefan Schulte wrote:
> Hi,
> 
> I've got a funny problem which causes the following exception. It's
funny
> because the program is running on my own machine, but it is not
running on
> the machine of a colleague of mine (actually, it is running without
problems
> on at least two different machines in different networks; the exactly
same
> problems occur also on at least two different machines). We are
running the
> exact same program code, the exact same parameters etc. pp.
> 
> javax.mail.MessagingException: Failed to load IMAP envelope
>       at
com.sun.mail.imap.IMAPMessage.loadEnvelope(IMAPMessage.java:1226)
>       at
com.sun.mail.imap.IMAPMessage.getSubject(IMAPMessage.java:331)
>       at
>
de.soknos.components.dispatcher.impl.DispatcherImpl.processNewMail(Dispa
tcherImpl.java:218)
>       at
>
de.soknos.components.dispatcher.impl.DispatcherImpl.pullMessagesFromDisp
atcher(DispatcherImpl.java:484)
>       at
>
de.soknos.components.dispatcher.impl.DispatcherImpl.main(DispatcherImpl.
java:62)
> 
> Actually, this happens when the first message from "INBOX" is fetched,
the
> corresponding DEBUG-output on the console is:
> 
> A4 FETCH 1 (ENVELOPE INTERNALDATE RFC822.SIZE)
> * 1 FETCH (ENVELOPE ("Thu, 16 Oct 2008 19:19:19 +0200" "[PROCESSED]
Fwd:
> Test Nummero 3 [MESSAGE]" (("Stefan Schulte" NIL "ste.schulte"
> "gmail.com")) (("Stefan Schulte" NIL "ste.schulte" "gmail.com"))
(("Stefan
> Schulte" NIL "ste.schulte" "gmail.com")) ((NIL NIL "soknos"
> "kom.tu-darmstadt.de")) NIL NIL
> "<[email protected]>"
> "<[email protected]>") INTERNALDATE
> "16-Oct-2008 19:19:19 +0200" RFC822.SIZE 4696)
> A4 OK FETCH completed.
> 
> This output is exactly the same for my colleague and me. Nevertheless,
the
> MessagingException occurs only on his machine.
I don't see anything obviously wrong with the response.
Are you sure you're using the same version of JavaMail on all machines?
What version information do you see in the beginning of the debug
output?
What operating systems are used on all machines?
Are all machines talking to the same mail server?
Is the program running in the same environment on all machines,
e.g., running as a standalone program or running in an application
server?
> However there seems to be more than this - while it was sufficient to
> connect to the INBOX by                       
> Store store = session.getStore("imap"); store.connect();
> 
> we had to change this to 
> 
> Store store = session.getStore("imap");               
> store.connect(session.getProperty("mail.imap.host"),
> session.getProperty("mail.imap.user"),                        
> session.getProperty("mail.user.password"));
> 
> Before this, my colleague was getting an
AuthenticationFailedException.
To use the connect method with no arguments you have to set up an
Authenticator.  If you're running in an application server it's
possible the server has done that for you.
> Furthermore, while I am able to send messages without any problems,
the
> mails sent by my colleague feature the wrong subject and "From". On
the
> other hand, setText() and setRecipients() work absolutely fine. Here
comes
> the corresponding code:
> 
> private void sendMail(Session session,
>             String subject, String url, String content,
>             String recipi, boolean attachment) throws
MessagingException,
>             AddressException {
>         final Properties props = session.getProperties();
>         SMTPMessage msg = new SMTPMessage(session);
>         Address[] address = new Address[1];
>         address[0] = new
> InternetAddress(props.getProperty("mail.smtp.from"));
>         msg.addFrom(address);
>        msg.setRecipients(javax.mail.Message.RecipientType.TO,
>                 recipi);
>         msg.setSubject(subject);
>         msg.setReplyTo(msg.getFrom());
>         inhalt = inhalt+"\n"+url;
>         msg.setText(inhalt, "UTF-8");
>         msg.setSentDate(new Date());
>         Transport tr = session.getTransport("smtp");
>       
>
tr.connect(props.getProperty("mail.smtp.host"),props.getProperty("mail.s
mtp.user"),
>                 props.getProperty("mail.smtp.password"));
>         msg.saveChanges();
>         tr.sendMessage(msg, msg.getAllRecipients());
>         tr.close();
>         try {
>             saveSentMail(msg);
>         } catch (UnknownHostException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     }
> 
> Has anybody ever heard of this? Any help is really appreciated!
The code looks fine.  The problem is almost certainly in the
environment.
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVAMAIL-INTEREST".  For general help, send email to
[email protected] and include in the body of the message "help".
msgmiddle
<Prev in Thread] Current Thread [Next in Thread>
Current Sitemap | © 2012 planetjava | Contact | Privacy Policy