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

Like our content? Sign up to our newsletter to keep in touch.
We'll never send spam, your data will be treated according to our privacy policy

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.