Open tomdh76 opened 7 months ago
Absolutely! It seems like you have a formatting error in the yaml configuration file you created.
Can you make sure that it matches the format here: https://github.com/VMannello/paperless-email/blob/main/sample.yaml
In the simplest layout (one email account and one tag) the yaml should look like this:
config.yaml
:
accounts:
- name: hotmail
email: account2@hotmail.com
smtp:
server: smtp.live.com
port: 587
username: account2@hotmail.com
password: account2_password
tls: true
tags:
simple:
from: hotmail
to:
- "recipient@email.com"
include_attachment: true
subject: "paperless processed a file {{ DOCUMENT_FILE_NAME }} | {{ DOCUMENT_CREATED }}"
body: "Processed {{ DOCUMENT_FILE_NAME }} | Download at: {{ DOCUMENT_DOWNLOAD_URL }}"
Absolutely! It seems like you have a formatting error in the yaml configuration file you created.
Can you make sure that it matches the format here: https://github.com/VMannello/paperless-email/blob/main/sample.yaml
It is now processing a bit further but stuck on [WARN] tag '' not found in configuration, skipping
Oh great. So the program is telling you that no tags were found on the input. Are you running this as a “post-consume” script as outlined by paperless? https://docs.paperless-ngx.com/advanced_usage/
The consumption process adds some environment variables that the script uses to determine what tags you’ve applied during consumption.
Today it won’t work on documents that have already been processed by paperless but that might be the next thing I build into it.
Oh great. So the program is telling you that no tags were found on the input. Are you running this as a “post-consume” script as outlined by paperless? https://docs.paperless-ngx.com/advanced_usage/
The consumption process adds some environment variables that the script uses to determine what tags you’ve applied during consumption.
Today it won’t work on documents that have already been processed by paperless but that might be the next thing I build into it.
Thanx, I will try for future consumptions!
If it works could you come back and comment or close the issue? And of course happy to help further if it’s still buggy.
Next hurdle:
In my configuration file I have this :
PAPERLESS_POST_CONSUME_SCRIPT=/opt/paperless/scripts/pmail/pmail_linux config.yaml
pmail_linux and config file are at that location but I got the following error in paperless:
[2024-02-08 17:16:31,263] [ERROR] [paperless.consumer] Configured post-consume script /opt/paperless/scripts/pmail/pmail_linux config.yaml does not exist.
Can you try putting it in quotes? If it can’t find the config.yaml you might need to include the entire path to it (i.e. include /opt/paperless/… in front of the config.yaml)
PAPERLESS_POST_CONSUME_SCRIPT=“/opt/paperless/scripts/pmail/pmail_linux config.yaml”
The other option is possibly the path to the script relative to where the paperless binary is running?
Can you try putting it in quotes? If it can’t find the config.yaml you might need to include the entire path to it (i.e. include /opt/paperless/… in front of the config.yaml)
PAPERLESS_POST_CONSUME_SCRIPT=“/opt/paperless/scripts/pmail/pmail_linux config.yaml”
The other option is possibly the path to the script relative to where the paperless binary is running?
No unfortunately not working. I tried with and without quotes, and using the entire path before config.yaml. If I try another script like "/opt/paperless/scripts/test.sh" it is working. I think it has something to do with the combination of loading pmail_linux with config file.
Thanks for this software, it looks like the perfect addition to my scanning workflow! Unfortunately it doesn't work, I run into this same issue.
I generated some PDFs here, and put them in my consume folder. In a subfolder that should be processed as tag. This subfolder-tag should result in an e-mail from pmail.
I have the paperless-ngx stack in Docker / Portainer, configured as per the instructions.
PAPERLESS_POST_CONSUME_SCRIPT: "/usr/src/paperless/scripts/pmail_linux pmail.yaml"
The scripts-folder is host bind mount and this folder contains the executable (+x) and the config.
File-PcjyN.pdf: Configured post-consume script /usr/src/paperless/scripts/pmail_linux pmail.yaml does not exist.
I think @tomdh76 is on to something, when I can all simple .sh-script without additional arguments, it results in different output (command line arguments?), see here:
`File-H6k0o.pdf: Error while executing post-consume script: Command '['/usr/src/paperless/scripts/pmail.sh', '941', '2024-04-03 <Correspondent> File-H6k0o.txt', '/usr/src/paperless/media/documents/originals/<redacted>/File-H6k0o.txt', '/usr/src/paperless/media/documents/thumbnails/0000941.webp', '/api/documents/941/download/', '/api/documents/941/thumb/', '<Redacted>', 'Tag1,Inbox,mail-tag']' returned non-zero exit status 127.
I seem to have some success with a small bash-wrapper.
I used full paths for both, because you can't assume the working directory to be the scripts-folder.
#!/usr/bin/env bash
/usr/src/paperless/scripts/pmail_linux /usr/src/paperless/scripts/pmail.yaml
First time it sent me a .txt-file, second time it was a 0 byte .pdf. The body of the mail is also empty.
Hope this helps!
I seem to have some success with a small bash-wrapper.
I used full paths for both, because you can't assume the working directory to be the scripts-folder.
#!/usr/bin/env bash /usr/src/paperless/scripts/pmail_linux /usr/src/paperless/scripts/pmail.yaml
First time it sent me a .txt-file, second time it was a 0 byte .pdf. The body of the mail is also empty.
Hope this helps!
Yes this seems to be the way, thx!
edit: except that the attached pdf 'cannot be read by adobe due to encoding or damaged pdf...?" If I use an outlook email address as receiver I do not get the pdf but an error:
Invalid MIME Content: Single text value size (33000) exceeded allowed maximum (32768) for the '' header
Thanx for this script. Could you help me to get this to work in a non docker LXC? I am using tteck proxmox scripts (https://tteck.github.io/Proxmox/). I copied all files from your github including pmail_linux to the script folder on the LXC. I then did chmod +X pmail_linux. When I tried to execute the script with ./pmail_linux config.yaml I get an error 'could not load configuration:yaml: line 2: did not find expected key'