ImapMailReceiver NO STORE attempt on READ-ONLY folder (Failure) [THROTTLED];

前端 未结 1 1163
长情又很酷
长情又很酷 2021-01-21 14:28

I spend day trying to find some explanation this exception. I try to configure ImapMailReceiver and ImapIdleChannelAdapter programmatic.

I didn\'t find any tutorials abo

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-21 14:43

    You should call imapMailReceiver.afterPropertiesSet(), which switches this.folderOpenMode = Folder.READ_WRITE;. In your case it looks lie here:

    imapMailReceiver.setJavaMailAuthenticator(new Authenticator() {
    ...
    });
    
    imapMailReceiver.afterPropertiesSet();
    

    Actually almost all Spring Integration components should be configured as Spring beans and Container will take care about their initialization. The new 4.0 version provides enough options for JavaConfig: https://spring.io/blog/2014/04/30/spring-integration-4-0-released .

    It's not clear to me why by default it is Folder.READ_ONLY and there is no setter on the matter.

    Feel free to raise a JIRA issue: https://jira.spring.io/browse/INT

    In which case I should use ImapIdleChannelAdapter and when just Session for getting store and connecting to mailbox.

    Actually it depends on your Mail provider. Spring Integration provides two components: Pop3MailReceiver and ImapMailReceiver. Of course Imap is better, because it doesn't fetch messages to the local directory and supports Listener. Pop3 you should ping periodically.

    0 讨论(0)
提交回复
热议问题