我正在使用Spring集成邮件收到传入邮件到我的Gmail帐户。邮件收到没有问题,但它总是在我的Gmail帐户中标记为已读。这是我的XML配置:
<int:channel id="receiveChannel"/>
replace 'userid and 'password' with the real values
<int-mail:imap-idle-channel-adapter id="customAdapter"
store-uri="imaps://proximahaiz%40gmail.com:myPassword@imap.gmail.com:993/inbox"
channel="receiveChannel"
auto-startup="true"
should-delete-messages="false"
should-mark-messages-as-read="false"
java-mail-properties="javaMailProperties"
/>
<util:properties id="javaMailProperties">
<prop key="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
<prop key="mail.imap.socketFactory.fallback">false</prop>
<prop key="mail.store.protocol">imaps</
<prop key="mail.debug">false</prop>
</
我添加了一个参数 should-mark-messages-as-read =“false”,但所有接收消息仍标记为已读。 我使用了Spring集成的4.2.9.RELEASE版本。 这是我的java代码:
public class GmailInboundImapIdleAdapterServiceImpl implements GmailInboundImapIdleAdapterService {
private static Logger logger = Logger.getLogger(GmailInboundImapIdleAdapterServiceImpl.class);
private static String MAIL_SUBJECT = "mail_subject";
private static String MAIL_FROM = "mail_from";
private static EmailParser emailParser = new EmailParser();
@Autowired
private EmailReceiverService emailReceiverService;
@Override
public void startReceiveEmails() {
ApplicationContext acProxy = new ClassPathXmlApplicationContext("/integration/gmail-imap-idle-config-proxytest.xml");
DirectChannel inputChannelProxy = acProxy.getBean("receiveChannel", DirectChannel.class);
inputChannelProxy.subscribe(new MessageHandler() {
@Override
public void handleMessage(Message<?> message) throws MessagingException {
initMessageReceiving(message);
}
});
}
我收到申请后,如何在gmail帐户中留下标记为未读的邮件?
答案 0 :(得分:0)
将@items = Item.order(params[:order])
java属性更改为mail.debug
。
将标记消息读取标志设置为false时,适配器不应设置true
标志,可以通过查看调试输出来确认。
如果是这种情况,Gmail可能不会遵守IMAP协议并使用其他一些标准将邮件标记为已读。