One possible solution is to use the "BODY.PEEK[]" command instead of "BODY[]" when fetching the email content. This will prevent the email from being marked as read and will allow you to fetch the content of the original email instead of the forwarded email.
Here's an example code snippet:
// connect to the IMAP server
$imap = imap_open('{imap.example.com:993/imap/ssl}INBOX', 'username', 'password');
// fetch the email headers and body
$headers = imap_headerinfo($imap, $msgno);
$body = imap_fetchbody($imap, $msgno, '1.1', FT_PEEK);
// close the IMAP connection
imap_close($imap);
In this example, we're using the "FT_PEEK" flag to prevent the email from being marked as read. We're also specifying the "1.1" part number to fetch the content of the original email instead of the forwarded email.
Note that this solution assumes that the original email is included as an attachment in the forwarded email. If the original email is not included as an attachment, you may need to use a different approach to fetch the content of the original email.