my $imap = Mail::Transport::IMAP4->new(...); my $message = $imap->receive($id); $imap->send($message);
See SYNOPSIS in Mail::Transport::Receive
The IMAP4 protocol is quite complicated: it is feature rich and allows verious asynchronous actions. The main document describing IMAP is rfc3501 (which obsoleted the original specification of protocol 4r1 in rfc2060 in March 2003).
This package, as part of MailBox, does not implement the actual protocol itself but uses Mail::IMAPClient to do the work. The task for this package is to hide as many differences between that module's interface and the common MailBox folder types. Multiple Mail::Box::IMAP4 folders can share one Mail::Transport::IMAP4 connection.
The Mail::IMAPClient module is the best IMAP4 implementation for Perl5, but is not maintained. There are many known problems with the module, and solving those is outside the scope of MailBox. See http://rt.cpan.org/Public/Dist/Display.html?Name=Mail-IMAPClient for all the reported bugs.