Answer the question
In order to leave comments, you need to log in
How to receive and process files by e-mail?
It is necessary to process letters with attachments coming to a specific address, i.e. configure the mail server so that it saves the attachment to a specific location and calls my php script with the parameters "from", "subject" and "attached file". In which direction to dig, what to twist? I'm not a specialist in nix administration, but I can read man, if anything.
Answer the question
In order to leave comments, you need to log in
sendmail (which is an MTA, not a PHP script) can call scripts as a "delivery" of incoming messages, passing the entire set of SMTP fields and their data to stdin, i.e. it is enough to write a parser; Another option is to write a letter parser (there is no built-in parameter for issuing an attachment) in the language of sendmail itself, but you are more likely to invoke half of Hell while doing this, writing an SMTP letter parser is easier and faster to google.
You didn't specify OS and mailer.
But if this is something from the Unix world, then procmail is attached to sendmail/exim/postfix. It filters, adds, executes scripts. Doesn't work with virtual accounts
I did it like this: https://habrahabr.ru/post/126448/
Only instead of robot: "|php -q /path/to/script.php" I have robot: "|cd /path/to/script && php - q script.php" and get the error Diagnostic-Code: x-unix; sh: 1: cd: can't cd to /path/to/script
Looks like you're missing permissions for the postfix user? How to add them so as not to break anything? The rights to the directory are 755, on the level above - 750, maybe this is the case?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question