I was having another look at this.
Another method, and one that would not require passwords being thrown around, is to try and use procmail and a script to process the PDF.
I have been messing about with this at work but get stuck on passing the body of the mail message to the script. I can get the script to run from .procmailrc but just can't see the body which is mean to be on STDIN. Allegedly.
Something like this seems to copy the mail to the 'Printed' directory and echo a bit to a tmp file but no idea how top access the actual mail body:
# ---- user rules ------------------
:0
* ^Subject.*Order
{
:0cWhi
|~/echotest.sh
:0
$MAILDIR/.Printed/
}
I'm pretty sure if I can get the mail body then the scripts we have already got will process the mail.
Any suggestions appreciated.