Deluge - forward incoming email with original attachments and content but new subject

Deluge - forward incoming email with original attachments and content but new subject

I'm working in ZohoMail with a 10GB paid account.

Using a filter and a custom function, I can send a new mail with the original email content and a new subject, but I'm struggling to find how to attach the original attachment to a new mail - or even to locate the attachment on the original mail:

messageDetails = zoho.mail.getMessage(mail_messageId,DREconnection);
mailSubject = messageDetails.get("SUBJECT"); //works fine
mailContent = messageDetails.get("CONTENT"); works fine
attachments = messageDetails.get("attachments"); //produces no result and crashes the script

I've googled and chatgpt'd but cant find a script that will work in zohomail.

Can anyone offer any help or point me to a suitable tutorial?