TomeEE JavaMail IMAP APPEND messages to Exchange mailbox -


last week have started working imap mailbox manipulations in tomee 1.7.0 environment (which contains geronimo javamail 1.4_1.8.3 implementation) connecting ms exchange 2007 mail server , have met strange behaviour. based on google search have found many others facing same difficulties.

when following imap command executed on imap connection:

a28 append foldername () "29-jun-2015 15:01:29 +0200" {7166} + ready additional command text. 

the following exception rises:

org.apache.geronimo.javamail.util.commandfailedexception: error response received on imap continued command:  + ready additional command text. @ org.apache.geronimo.javamail.store.imap.connection.imapcommand.writeto(imapcommand.java:205) ~[geronimo-javamail_1.4_mail-1.8.4.jar:1.8.4] @ org.apache.geronimo.javamail.store.imap.connection.imapconnection.sendcommand(imapconnection.java:319) ~[geronimo-javamail_1.4_mail-1.8.4.jar:1.8.4] @ org.apache.geronimo.javamail.store.imap.connection.imapconnection.sendsimplecommand(imapconnection.java:287) ~[geronimo-javamail_1.4_mail-1.8.4.jar:1.8.4] @ org.apache.geronimo.javamail.store.imap.connection.imapconnection.appendmessage(imapconnection.java:1425) ~[geronimo-javamail_1.4_mail-1.8.4.jar:1.8.4] @ org.apache.geronimo.javamail.store.imap.imapfolder.appendmessage(imapfolder.java:1564) ~[geronimo-javamail_1.4_mail-1.8.4.jar:1.8.4] @ org.apache.geronimo.javamail.store.imap.imapfolder.appendmessages(imapfolder.java:988) ~[geronimo-javamail_1.4_mail-1.8.4.jar:1.8.4] 

the code quite simple:

@localbean @stateless public class imapmailmanager {      @resource(name = "mail/mystore")     private session storesession;      public void addmessagetofolder(mimemessage message, string targetfoldername) {       store store = storesession.getstore();        properties props = storesession.getproperties();       connectusername = props.getproperty("mail.imaps.user");       connectpassword = props.getproperty("mail.imaps.password");       store.connect(connectusername, connectpassword);        list<mimemessage> messagestocopy = new arraylist<>();       messagestocopy.add(message);       message[] messages = new message[messagestocopy.size()];       // exception raises @ following line:       store.getfolder(targetfoldername).appendmessages(         messagestocopy.toarray(messages)       );     } } 

i have following configuration in tomee.xml:

<resource id="mail/mystore" type="javax.mail.session">     mail.store.protocol=imaps     mail.imaps.host=mailserver.domain.com     mail.imaps.port=993     mail.imaps.auth=true     mail.imaps.user=user@domain.com     mail.imaps.password=thepassword     mail.imaps.auth.ntlm.disable=true     mail.imaps.auth.gssapi.disable=true     mail.imaps.auth.plain.disable=true     mail.debug=true </resource> 

i have found lot of thing on google search gave me ideas , helped me small step forward:

this closest 1 authentication problem (because had one):

i have read topic http://www.oracle.com/technetwork/java/javamail/faq/index.html#commonmistakes

so had many more search ... have tried patch, upgrade geronimo not helped.

and have found right answer here @ http://tomee-openejb.979440.n4.nabble.com/tomee-javamail-problems-td4672429.html

so conclusion not using geronimo javamail implementation more oracle javamail reference implementation instead.

and after changes worked should.


Comments