We might as well get this question answered. As @HenryGibson pointed out, this is not possible with <cfimap>
: it does not expose the relevant functionality. See the PEEK note on FETCH in the RFC: "6.4.5. FETCH Command". That's what you need to be able to do, and you have no control over that stuff with <cfimap>
However Java has a library for access mail stores via IMAP: IMAPStore; and looking at the docs for IMAPMessage it (unsurprisingly) supports the PEEK option on a fetch: setPeek()
.
So it'll definitely be doable. It's a shame <cfimap>
doesn't make this simple for you though: it might be worth raising an E/R for it on the bugbase.
I think you need to give it a bash with Java, and if you run into issues, then raise a question here relevant to that. I've not personally taken the java route, so can't give you a quick "101" on it, and it's not sufficiently trivial as to really be a fit for an answer here (and I have to concede I don't have motivation to get up to speed with it enough to do so).
But <cfimap>
will not be part of your solution to this, I'm afraid.
BODY[part]
implicitly marks the seen flag, fetching it withBODY.PEEK[part]
will prevent this behaviour. – Pepito