If you give an IMAP find method a block with three arguments instead
of the usual one, it will yield the message, the imap connection, and
the uid of the message. You can use the imap connection and uid to do
a variety of different things with the message at that point. So it
would be something along the lines of:
Mail.find(...) do |message, imap, uid|
...
imap.uid_copy(uid, 'archive')
...
end
-- donald