mguessan / davmail

DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange and Office 365 Gateway - Synced with main subversion repository at
http://davmail.sourceforge.net
GNU General Public License v2.0
576 stars 85 forks source link

FETCH RFC822 compliant #298

Closed josescal closed 1 year ago

josescal commented 1 year ago

We are using Davmail in server mode to connect RingCentral Engage Digital (using IMAP/SMTP) with O365 mailbox through EWS

RingCentral R&D team has shared their observations with us and discovered that Davmail IMAP server is not compliant. Therefore, emails cannot be imported on your customer's platform. We fetch emails with RFC822 but here is what we receive from your end: 03 UID FETCH 175 RFC822

The problem is well located in ImapConnection.java in this pieze of code:

                    if ("RFC822.HEADER".equals(param)) {
                        buffer.append(" RFC822.HEADER");
                    } else {
                        buffer.append(" BODY[");
                        if (partIndexString != null) {
                            buffer.append(partIndexString);
                        }
                        buffer.append(']');
                    }

As you can observe only "RFC822.HEADER" param is taking into account to answer in the same way. So the solution should be something like this:

                    if ("RFC822".equals(param)) {
                        buffer.append(" RFC822");
                    } else if ("RFC822.HEADER".equals(param)) {
                        buffer.append(" RFC822.HEADER");
                    } else {
                        buffer.append(" BODY[");
                        if (partIndexString != null) {
                            buffer.append(partIndexString);
                        }
                        buffer.append(']');
                    }
esabol commented 1 year ago

@josescal, would you be willing to submit a PR?

mguessan commented 1 year ago

Fixed in trunk, thanks for your contribution