Page 1 of 1

Mail with attachment

Posted: Fri Jun 14, 2024 10:58 am
by JanBob
Hello everyone.

I would like to set up an automatic mail dispatch in which a mail with attachment is sent weekly. (Workflow with the node "Send e-mail" and a scheduler in the web interface).
The attachment is always the same file, but the file name sometimes changes from "Testfile 1.xlsx" to "Testfile 2.xlsx" etc. I have tried "Testfile*.xlsx", but the * is not accepted.

Do you have any tips?

Thanks a lot!
Jan

Re: Mail with attachment

Posted: Fri Jun 14, 2024 11:35 am
by emcodem
Hi,

Sorry i am a little bit confused about this because you say it is always the same file but the filename changes... If the filename changes (and i assume the content changes too), in which way is it "always the same file" then?

My first thought however is that there is the files find plugin processor, it is kind of best friend with the job scheduler feature :D

In this case, files find would set the variable s_temp (you can use s_source instead of course) to the FIRST found file that matches the include filter:
filef.jpg
filef.jpg (33.44 KiB) Viewed 4981 times

Re: Mail with attachment

Posted: Mon Jun 17, 2024 7:39 am
by JanBob
Good morning and sorry for the confusion. Of course it is not the same file, because the name and content changes. :D

And sorry, I completely overlooked the plugin processors. There is still a lot for me to discover.
Thanks for your help, emcodem, I'll look into it!

Re: Mail with attachment

Posted: Mon Jun 17, 2024 12:06 pm
by JanBob
Sorry, but I don't get it.

I installed the plugins and configured the "Find Files" with %s_temp%. But the e-mail-processor keeps sending mails with the attachment "s_temp.txt", not "testfile.xlsx".

Re: Mail with attachment

Posted: Mon Jun 17, 2024 9:21 pm
by emcodem
Hehe ok so sending "not the same file" makes a lot of sense, altough you could just use the normal watcholder for this maybe :D But i guess you have your reasons why you want to schedule this, so lets go on.

So you want to make sure that files find works as expected, e.g. %s_temp% has been filled with a valid filename.
While you build your workflow you can just connect a populate vars processor after files find and let it set %s_success% to %s_temp% so you can see in the "outcome" field of the jobmonitor what the variable contained. Did you actually "create" the user variable s_temp in the variables window (it might not work to use "non existing" variables)?

Once you are convinced that s_temp contains the filename, you can test if it now sends the email as expected, this should work.
After that, if you like you could insert a conditional after the files find and check if
$exists("%s_temp%") = 1

You could then insert a second email processor at the end, rightclick it's input pin and set it to execute on error, then connect the output of conditional to the 2 email processors (one for success path, one for error path)
Error handling is e.g. explained in the sticky thread:
viewtopic.php?p=3582#p3582

Re: Mail with attachment

Posted: Thu Jun 20, 2024 9:33 am
by JanBob
Thank you for your explanations. I could see that the problem was due to missing permissions. Now it works as desired. :)