Joplin mail gateway

Not sure if this is the right place but I have a question about a bash script for importing forwarded emails to Joplin (GitHub - manolitto/joplin-mail-gateway: Simple (bash-based) mail gateway for the open source note taking and to-do application Joplin).

I've got it working on my server and importing emails from gmail to Joplin. However, the attachments are malformed.

From the logs, I can see that the script is trying to add the attachment through the joplin cli command line app.


Usage: attachFile note-id file

function attachFile {
echo "Attach file basename "$2""
joplin attach "$1" "$2"

The attachment is sent to the joplin note as


If I remove the 'resources' and replace it with ':' and take off the '.pdf' on the end, the attachment loads just fine.

I have no idea why it's passing $2 filename to joplin via the attach command and it's coming out 'resources/fcd957dfbe0a4756a8a5cf8db33188cb.pdf' as the attachment in the creatred Joplin note.
I relied on importing notes via email in Evernote and would like to get this working if possible. Any ideas or help would be appreciated. If this should be in another category, I can ask there. Thanks!