I’m using 365 Scope and Get Email List, then looping through the list, downloading each email, and then adding each to an IEnumerable(of ILocalResource) to be attached to an email with Send SMTP.
Frequently when it tries to send the email it says it can’t find the file. I have a Log Message showing me the file path immediately after it’s downloaded. When I watch the folder, the file appears then disappears.
It’s your Download Email activity and it automatically decides the path and filename. An example: C:\Users\xxxxxxxx\AppData\Local\Temp\1\ndqk02o1.3ut.eml
I do not have a step that clears the files after download.
There can’t be a policy like that because sometimes it works. Also, it can’t be content-based because during development I’m literally downloading the same email each run.
Regarding project sample, it’s literally just this:
Hello! Because our automations can run in the cloud on robots where the file would be of no use after the workflow execution has ended, we save the email in a temporary location and remove it once the workflow execution ends. The onus is on the user to do something with it inside the automation.
A second option to preserve the email is to populate the Destionation Path input. If you do, the file is persisted.
This usually happens because the file you’re adding to the attachment list is getting deleted or disposed before the SMTP activity actually sends the mail.
With O365 activities, downloaded emails are often saved to a temporary location and can be cleaned up automatically (especially when the scope/iteration ends). So even though you log the path and briefly see the file in the folder, it disappears before Send SMTP Mail Message tries to attach it.
After downloading the email, copy or move it to a permanent folder (for example, a project or temp directory you control) and use that new path for the attachment.
Make sure the attachment list is built after the file is fully written and in its final location.
If this is inside a For Each or O365 Scope, avoid relying on auto-generated temp paths.
In short, don’t attach the file directly from the O365 download location—save it somewhere stable first, then add it to the IEnumerable(Of ILocalResource) and send the email.
The downloaded email is stored in a temporary location managed by the O365 Scope. That temp file is not guaranteed to stay available for a consistent amount of time. Sometimes the SMTP activity runs fast enough and attaches the file before the scope or GC cleanup removes it, so it works. Other times, the cleanup happens first, so SMTP can’t find the file and throws the error. That’s why it feels random.
When you move or copy the file to a folder you control, it’s no longer tied to the O365 Scope’s temporary lifecycle. The file stays on disk until you explicitly delete it, so Send SMTP Mail Message can reliably access it every time. This makes the process deterministic instead of timing-dependent.