Mail with attachment

Questions and answers on how to get the most out of FFAStrans
Post Reply
JanBob
Posts: 9
Joined: Fri Mar 08, 2024 12:45 pm

Mail with attachment

Post 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
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Mail with attachment

Post 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 6202 times
emcodem, wrapping since 2009 you got the rhyme?
JanBob
Posts: 9
Joined: Fri Mar 08, 2024 12:45 pm

Re: Mail with attachment

Post 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!
JanBob
Posts: 9
Joined: Fri Mar 08, 2024 12:45 pm

Re: Mail with attachment

Post 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".
Attachments
Unbenannt2.png
Unbenannt2.png (3.47 KiB) Viewed 6166 times
Unbenannt.png
Unbenannt.png (36.14 KiB) Viewed 6166 times
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Mail with attachment

Post 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
emcodem, wrapping since 2009 you got the rhyme?
JanBob
Posts: 9
Joined: Fri Mar 08, 2024 12:45 pm

Re: Mail with attachment

Post by JanBob »

Thank you for your explanations. I could see that the problem was due to missing permissions. Now it works as desired. :)
Post Reply