Describe the problem/error/question
At the end of my workflow, I want to attached documents to an email. I see the documents in the input of the microsoft Outlook node (There is a button Download to have it). But there is an error.
I saw another topic about it “Outlook Node Draft Creation Fails”, but the answer in understandable and not very secure for us. Do you have another solution. The Attachment option of this node is useless ?
What is the error message (if any)?
“were unable to deserialize”
Please share your workflow
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system:
Hi @JulienInfo Have you tried uploading your attachments to the google drive and then downloading that file before the email and sending it that way? This seems a much secure process and is aligned to your will on however you want to save files in your drive, hope this helps.
No, it works correctly on my end:
Your issue is with your Code node and the binary referencing:
In most cases, you do not need to use a Code node unless you know exactly what you’re doing,
You can simply use a Set node with the binary data field, and then reference this binary data in the following nodes..
1 Like
Hi, no I can’t do that with these documents (professional document in a M365 database)
@JulienInfo i understand your cautious with M365 documents. I guess then Instead of sending the files themselves, you could send secure SharePoint/OneDrive links with strict permissions and expiry, or apply M365 sensitivity labels/encryption so the files stay protected even if the email is intercepted. As the most straightforward way is already suggested by @mohamed3nan.
Hi,
I’m surprised it works (but happy also !). I agree about the problem with the binary part, but I can’t identify the correct syntax. The code node is used here to add the extracted attachments to the information needed for the email. It works perfectly without adding the attachment.
So I need to rework the binary part. What surprises me is that I do have access to the attachments as input to the node. But I must have defined them incorrectly.
I’ll continue my research. Thank you for your feedback.
2 Likes
hmmm, while I don’t like code nodes, I was curious about this issue, so I generated some test data since I don’t exactly know what type of files you’re trying to attach, or whether the code might be corrupting the file,
your attached workflow works fine btw with some test data and with an Excel file as an attachment:
So, to save you some time, at this point the issue is most likely related to the binary files,
Also, the Code node is running in “Run Once for All Items” mode, which I think could also cause issues when working with binary,
so as I mentioned, if I were to do this I wouldn’t use a Code node,
Instead, I’d use a Set node with a binary field with Merge/Aggregate nodes, this should give the same result I think..
HI, I tried a simple way (only a excelsheet, no code), but the same error. So is it possible that the pb is from credential aspect ?
1 Like
When I look at API authentication via Microsoft Graph for N8N, what permissions are needed to attach a document to a DRAFT Email - Resource DRAFT (it’s working to send an email with attached documents - Resource : MESSAGE, not to attach a document in a draft email - Resource : DRAFT)?
1 Like
hmm, these are the permissions I see in my app:
I don’t remember doing anything specific,
Everything was pretty straightforward, I just followed the docs exactly from here:
Hello all,
I have an hypothesis on the bug root cause detailed in the thread. If you have coding skills and you are used to contribute to n8n, please feel free to test it.
This bug is known since a while and the issue thread is here. Please comment this thread as much as possible so that n8n team take a look at it.
Hi.
Sorry but my coding skills are too limited.
I can try to integrate something into my workflow, but please explain the method clearly.
Regards