Forwarder of email

Hello, I’m trying to build an email forwarder for our PEC address that don’t support this feature on new pec arrival.
So I started with IMAP Node and SMTP but I cannot send attachments, so I try to insert Function to extract Binary but how can i attach them to smtp?
this is my file

Regards
Alex

Hey @smilzao,

Welcome to the community :sparkling_heart:

Thank you for sharing the workflow code. I took a quick glance, and I have made some changes to it. You can use the below workflow

Please note that I’ve not tested it, so it may not cover all the edge cases, however, tweaking it a bit would solve it!

Thank you, now it sends mail with attachments even I receive one mail for any attach.
No I try to study to send only one mail with all attachs

Thank you again
Alex

Ah yes. As mentioned earlier, I didn’t test it so it might have missed some edge case. Let me try it out :slight_smile:

Hey @smilzao,

Ran a quick test and found a solution. You can remove the Function node between the Email Read IMAP node and the Send Email node. In the Attachments parameter of the Send Email node you should use this expression: {{Object.keys($binary).join(',')}}. This expression will reference the name the binary data, and create a comma separated list. You will then receive a single email with multiple attachments. This will also work if an email has a single attachment.

Your workflow should like this: