-2

I would like to "misuse" my email a little for a printing work. I have the whole setup ready but lack how to get my emails from my mailserver immediately as soon they arrive.

In short I will get an email with a pdf attachment and need to print the attachement. It works well with procmail, uudeview and a script to print pdf files. However I need to get download the email immediately which does not work yet.

I was looking in both fetchmail and getmail. As far I understood fetchmail only works with a cronjob or daemon. I don't think that a cronjob should be run every 1 second.

I would be very grateful to learn if this can be achieved with getmail or if other programs are availbale to do this.

user3358102
  • 169
  • 1
  • 12

1 Answers1

1

Perhaps update your .forward file to immediately forward the mail to procmail? Or setup a rule to forward the mail to a system you control where you can do the processing immediately?

The .procmailrc setup on the incoming host would look like:

"|IFS=' '&&p=/usr/local/bin/procmail&&test -f $p&&exec $p -f-||exit 75#some_string"

You could also use something like AWS SNS and Lambda to process the mail events.

If you don't have those options, polling frequently would be your best bet. You can setup a script to poll every few seconds in a loop without generating much load on the server. Typically your cron job would check if the script is running, and if not, relaunch it, otherwise do nothing.

jspcal
  • 47,335
  • 4
  • 66
  • 68