Procmail should send my emails with the content to my api. No matter what I try, I get the subject etc., but I can't get to the content. The $CONTENT variable is filled with the subject.
:0
{
:0 w
| CONTENT= cat
:0
| URL=$(curl -d "content=$CONTENT" -d "title=Logged Activity" https://myapi.de/fetch.php);
}
You have a repeated syntax error;
means assign an empty string to
CONTENTfor the duration of thecatcommand. I guess your intent is to assign the message's contents to the variable. The syntax for that would be(not a recipe, so no
:0 wis useful, necessary, or correct here); but if you don't use this variable for anything else, there really is no need to assign it separately.As above, this also probably doesn't do what you actually want. If you expect the variable to be assigned within your
.procmailrc, tryThe trailing semicolon (or some other character from
SHELLMETAS) is required to force Procmail to run the subprocess in a shell (otherwise it would pass through the literal stringcontent=$(cat)as the value of the option-d).In some more detail, the recipe
would run a shell as a subprocess, and assign the message's contents as the value of the shell variable
variable, but then immediately exit, which of course loses any effects of variable assignments which happened within that subprocess.