Send all new files saved in a directory as email attachments

I wanted to send by email scans made with the printer I have at work. Once I have them in my email, it’s easier to archive/send them more easily.

Problem: the printer software is bugged and doesn’t allow to use my long, complex password, so I had two options:

  • Change the email password to be shorter
  • Think a workaround via a linux server

Obviously I opted for the second option!

It works like this: we tell the printer to save the PDFs on a network share, inotifywait waits that a new file is created, and then sendEmail sends it as an email attachment

The script has to be ran in a screen, and it runs in an infinite loop

Leave a Reply