Procmail deleting body
Clash Royale CLAN TAG#URR8PPP
I have a procmail recipe which sends the body of a mail to a script. Works well but procmail then sends the mail without the body to my default folder.
:0
* ^Subject.*Telemetry rotate$
:0 bf
! `/usr/bin/php -f /path/to/script/script.php`
How can I have procmail send the body to my script without deleting it or send a copy to a folder and then delete the original.
procmail
add a comment |
I have a procmail recipe which sends the body of a mail to a script. Works well but procmail then sends the mail without the body to my default folder.
:0
* ^Subject.*Telemetry rotate$
:0 bf
! `/usr/bin/php -f /path/to/script/script.php`
How can I have procmail send the body to my script without deleting it or send a copy to a folder and then delete the original.
procmail
Do the backticks work like a command substitution in the procmail config? I can't remember... Why would you want to use a command substitution there?
– Kusalananda
Dec 18 at 17:45
As far as I can (also) remember the backticks serves to "escape" the command
– Danny
Dec 18 at 17:53
The!
forwards the mail to the address that the PHP script outputs. That's what the!
at the start does. Is this what you intend? Did you intend to use|
instead? Check thepromailrc
manual...
– Kusalananda
Dec 18 at 18:02
I would regard it as surprising but not necessarily a bug that you can use thef
flag with an!
action. This is a corner case I have never seen before. I'm pretty sure the recipe doesn't do at all what you want; but your question really should spell out more explicitly what you do want. The idea that backticks "escape" a command is certainly nonsense.
– tripleee
Dec 18 at 19:56
yes, I want to pass the body to a script but also want a copy/original to be passed/sent to a folder for record purposes
– Danny
Dec 19 at 11:27
add a comment |
I have a procmail recipe which sends the body of a mail to a script. Works well but procmail then sends the mail without the body to my default folder.
:0
* ^Subject.*Telemetry rotate$
:0 bf
! `/usr/bin/php -f /path/to/script/script.php`
How can I have procmail send the body to my script without deleting it or send a copy to a folder and then delete the original.
procmail
I have a procmail recipe which sends the body of a mail to a script. Works well but procmail then sends the mail without the body to my default folder.
:0
* ^Subject.*Telemetry rotate$
:0 bf
! `/usr/bin/php -f /path/to/script/script.php`
How can I have procmail send the body to my script without deleting it or send a copy to a folder and then delete the original.
procmail
procmail
edited Dec 18 at 17:25
janos
7,12222347
7,12222347
asked Dec 18 at 17:25
Danny
6710
6710
Do the backticks work like a command substitution in the procmail config? I can't remember... Why would you want to use a command substitution there?
– Kusalananda
Dec 18 at 17:45
As far as I can (also) remember the backticks serves to "escape" the command
– Danny
Dec 18 at 17:53
The!
forwards the mail to the address that the PHP script outputs. That's what the!
at the start does. Is this what you intend? Did you intend to use|
instead? Check thepromailrc
manual...
– Kusalananda
Dec 18 at 18:02
I would regard it as surprising but not necessarily a bug that you can use thef
flag with an!
action. This is a corner case I have never seen before. I'm pretty sure the recipe doesn't do at all what you want; but your question really should spell out more explicitly what you do want. The idea that backticks "escape" a command is certainly nonsense.
– tripleee
Dec 18 at 19:56
yes, I want to pass the body to a script but also want a copy/original to be passed/sent to a folder for record purposes
– Danny
Dec 19 at 11:27
add a comment |
Do the backticks work like a command substitution in the procmail config? I can't remember... Why would you want to use a command substitution there?
– Kusalananda
Dec 18 at 17:45
As far as I can (also) remember the backticks serves to "escape" the command
– Danny
Dec 18 at 17:53
The!
forwards the mail to the address that the PHP script outputs. That's what the!
at the start does. Is this what you intend? Did you intend to use|
instead? Check thepromailrc
manual...
– Kusalananda
Dec 18 at 18:02
I would regard it as surprising but not necessarily a bug that you can use thef
flag with an!
action. This is a corner case I have never seen before. I'm pretty sure the recipe doesn't do at all what you want; but your question really should spell out more explicitly what you do want. The idea that backticks "escape" a command is certainly nonsense.
– tripleee
Dec 18 at 19:56
yes, I want to pass the body to a script but also want a copy/original to be passed/sent to a folder for record purposes
– Danny
Dec 19 at 11:27
Do the backticks work like a command substitution in the procmail config? I can't remember... Why would you want to use a command substitution there?
– Kusalananda
Dec 18 at 17:45
Do the backticks work like a command substitution in the procmail config? I can't remember... Why would you want to use a command substitution there?
– Kusalananda
Dec 18 at 17:45
As far as I can (also) remember the backticks serves to "escape" the command
– Danny
Dec 18 at 17:53
As far as I can (also) remember the backticks serves to "escape" the command
– Danny
Dec 18 at 17:53
The
!
forwards the mail to the address that the PHP script outputs. That's what the !
at the start does. Is this what you intend? Did you intend to use |
instead? Check the promailrc
manual...– Kusalananda
Dec 18 at 18:02
The
!
forwards the mail to the address that the PHP script outputs. That's what the !
at the start does. Is this what you intend? Did you intend to use |
instead? Check the promailrc
manual...– Kusalananda
Dec 18 at 18:02
I would regard it as surprising but not necessarily a bug that you can use the
f
flag with an !
action. This is a corner case I have never seen before. I'm pretty sure the recipe doesn't do at all what you want; but your question really should spell out more explicitly what you do want. The idea that backticks "escape" a command is certainly nonsense.– tripleee
Dec 18 at 19:56
I would regard it as surprising but not necessarily a bug that you can use the
f
flag with an !
action. This is a corner case I have never seen before. I'm pretty sure the recipe doesn't do at all what you want; but your question really should spell out more explicitly what you do want. The idea that backticks "escape" a command is certainly nonsense.– tripleee
Dec 18 at 19:56
yes, I want to pass the body to a script but also want a copy/original to be passed/sent to a folder for record purposes
– Danny
Dec 19 at 11:27
yes, I want to pass the body to a script but also want a copy/original to be passed/sent to a folder for record purposes
– Danny
Dec 19 at 11:27
add a comment |
1 Answer
1
active
oldest
votes
You have some errors here. The f
flag says to replace the message with the output from the filter (though the b
restricts this action to just the body). The braces are also superfluous here. So I'd go with
:0b
* ^Subject.*Telemetry rotate$
! `php -f /path/to/script/script.php`
if indeed the plan is to (1) pass the body to the PHP script, (2) capture the script's output (this is what the `backticks`
do) and (3) forward the message to the address captured (that's wat the !
action does).
If your intention is merely to pass the body to your script, that would be
:0b
* ^Subject.*Telemetry rotate$
| php -f /path/to/script/script.php
maybe also with a c
flag if you want to continue to process the message after this point.
You'll notice that I took out the hard-coded path /usr/bin
; hardcoding the path makes the script less portable, and makes it impossible (or at least extremely cumbersome) to replace php
with a wrapper for debugging purposes. I'd recommend to simply make sure you set up your PATH
correctly in production.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489729%2fprocmail-deleting-body%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have some errors here. The f
flag says to replace the message with the output from the filter (though the b
restricts this action to just the body). The braces are also superfluous here. So I'd go with
:0b
* ^Subject.*Telemetry rotate$
! `php -f /path/to/script/script.php`
if indeed the plan is to (1) pass the body to the PHP script, (2) capture the script's output (this is what the `backticks`
do) and (3) forward the message to the address captured (that's wat the !
action does).
If your intention is merely to pass the body to your script, that would be
:0b
* ^Subject.*Telemetry rotate$
| php -f /path/to/script/script.php
maybe also with a c
flag if you want to continue to process the message after this point.
You'll notice that I took out the hard-coded path /usr/bin
; hardcoding the path makes the script less portable, and makes it impossible (or at least extremely cumbersome) to replace php
with a wrapper for debugging purposes. I'd recommend to simply make sure you set up your PATH
correctly in production.
add a comment |
You have some errors here. The f
flag says to replace the message with the output from the filter (though the b
restricts this action to just the body). The braces are also superfluous here. So I'd go with
:0b
* ^Subject.*Telemetry rotate$
! `php -f /path/to/script/script.php`
if indeed the plan is to (1) pass the body to the PHP script, (2) capture the script's output (this is what the `backticks`
do) and (3) forward the message to the address captured (that's wat the !
action does).
If your intention is merely to pass the body to your script, that would be
:0b
* ^Subject.*Telemetry rotate$
| php -f /path/to/script/script.php
maybe also with a c
flag if you want to continue to process the message after this point.
You'll notice that I took out the hard-coded path /usr/bin
; hardcoding the path makes the script less portable, and makes it impossible (or at least extremely cumbersome) to replace php
with a wrapper for debugging purposes. I'd recommend to simply make sure you set up your PATH
correctly in production.
add a comment |
You have some errors here. The f
flag says to replace the message with the output from the filter (though the b
restricts this action to just the body). The braces are also superfluous here. So I'd go with
:0b
* ^Subject.*Telemetry rotate$
! `php -f /path/to/script/script.php`
if indeed the plan is to (1) pass the body to the PHP script, (2) capture the script's output (this is what the `backticks`
do) and (3) forward the message to the address captured (that's wat the !
action does).
If your intention is merely to pass the body to your script, that would be
:0b
* ^Subject.*Telemetry rotate$
| php -f /path/to/script/script.php
maybe also with a c
flag if you want to continue to process the message after this point.
You'll notice that I took out the hard-coded path /usr/bin
; hardcoding the path makes the script less portable, and makes it impossible (or at least extremely cumbersome) to replace php
with a wrapper for debugging purposes. I'd recommend to simply make sure you set up your PATH
correctly in production.
You have some errors here. The f
flag says to replace the message with the output from the filter (though the b
restricts this action to just the body). The braces are also superfluous here. So I'd go with
:0b
* ^Subject.*Telemetry rotate$
! `php -f /path/to/script/script.php`
if indeed the plan is to (1) pass the body to the PHP script, (2) capture the script's output (this is what the `backticks`
do) and (3) forward the message to the address captured (that's wat the !
action does).
If your intention is merely to pass the body to your script, that would be
:0b
* ^Subject.*Telemetry rotate$
| php -f /path/to/script/script.php
maybe also with a c
flag if you want to continue to process the message after this point.
You'll notice that I took out the hard-coded path /usr/bin
; hardcoding the path makes the script less portable, and makes it impossible (or at least extremely cumbersome) to replace php
with a wrapper for debugging purposes. I'd recommend to simply make sure you set up your PATH
correctly in production.
edited Dec 19 at 5:42
answered Dec 18 at 19:29
tripleee
4,92911727
4,92911727
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489729%2fprocmail-deleting-body%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do the backticks work like a command substitution in the procmail config? I can't remember... Why would you want to use a command substitution there?
– Kusalananda
Dec 18 at 17:45
As far as I can (also) remember the backticks serves to "escape" the command
– Danny
Dec 18 at 17:53
The
!
forwards the mail to the address that the PHP script outputs. That's what the!
at the start does. Is this what you intend? Did you intend to use|
instead? Check thepromailrc
manual...– Kusalananda
Dec 18 at 18:02
I would regard it as surprising but not necessarily a bug that you can use the
f
flag with an!
action. This is a corner case I have never seen before. I'm pretty sure the recipe doesn't do at all what you want; but your question really should spell out more explicitly what you do want. The idea that backticks "escape" a command is certainly nonsense.– tripleee
Dec 18 at 19:56
yes, I want to pass the body to a script but also want a copy/original to be passed/sent to a folder for record purposes
– Danny
Dec 19 at 11:27