Hello all, I am wondering if there is a possibility to realize the following scenario. I have a scanner which is capable of scan to email function. I would like to send the scan to a special email address managed by ISPconfig and then parse this email for attachments to automatically detach the PDF file to a local folder or even better to a nextcloud upload folder or a script. Can anyone assist in if this is possible and a hint how to do this? A quick summarization of the workflow: - Scan to email on scanner - Receive email and detach PDF attachments automatically - save to folder on server or handle it with a script Thanks in advance for any comments. Regards Marco
Two ways come to mind, create your email address ([email protected] or whatever) and then use either a postfix transport or a sieve filter to forward mail to your processing script. Using a postfix transport you would define the transport in /etc/postfix/master.cf then use Email Routing to set your email address to use it (enter the email address as the Domain, Type 'custom', and your transport (eg. 'extract-pdf:') as Destination. Using a sieve filter you would need to enable the extprograms plugin to make your processing script available in a sieve filter, then just write a simple sieve script for this email address which does that. Either action (copying to a "folder" on the server being moving a file to a location, not move message to an imap folder - the latter is trivial via sieve) will require an external script to extract the attached file and do something with it.
Thanks a lot for this answer. Both ways absolutely new to me. Dont know how to do it exactly, but now I have something to search for. Thanks again.
I thought the "transport option" could be worth a try. But a question again before doing this experiment. Can I add the new transport via ISPconfig gui or do I have to put it manually into the master.cf? If I have to do it manually the upcoming question would be if this is then upgrade safe or do I have to repeatedly add it again after an upgrade?
You define the transport in master.cf manually, then set the email address to use it in the ui. It will be upgrade safe.
Is it possible to show an example of how you define the transport in /etc/postfix/master.cfmaster.cf the the processing script used?
My /etc/postfix/master.cf is like this: Code: extract-attachments unix - n n - - pipe flags=X user=web22 size=26214400 argv=/scriptarchive/local/extract-attachments.sh After this I used ISPConfig to define a transport for a specific email address to this transport extract-attachments.