On Dec 22, 2016, at 12:36 PM, Wietse Venema wrote: # Final command. Shell will remove the temp file and exit with # Sendmail's exit code. /usr/sbin/sendmail "$@"And do not forget the '--' inpipe ... argv=/path/to/script -f ${sender} -- ${recipient}And the missing "< $msg" in the final command: /u
> On Dec 22, 2016, at 12:36 PM, Wietse Venema wrote:
>
>> # Final command. Shell will remove the temp file and exit with
>> # Sendmail's exit code.
>> /usr/sbin/sendmail "$@"
>
> And do not forget the '--' in
> pipe ... argv=/path/to/script -f ${sender} -- ${recipient}
And the
Viktor Dukhovni:
>
> > On Dec 22, 2016, at 3:51 AM, St?phane MERLE
> > wrote:
> >
> > First, I save the message in the file descriptor 3
> >
> >msg=$(mktemp /tmp/msg.XX) || exit 75
> >cat > $msg || { rm $msg; exit 75; }
> >exec 3< $msg || { rm $msg; exit 75; }
> >rm $msg
>
> On Dec 22, 2016, at 3:51 AM, Stéphane MERLE
> wrote:
>
> First, I save the message in the file descriptor 3
>
>msg=$(mktemp /tmp/msg.XX) || exit 75
>cat > $msg || { rm $msg; exit 75; }
>exec 3< $msg || { rm $msg; exit 75; }
>rm $msg
>
> then I use it by rewinding it :
>
Hi Viktor,
I though I new a little of bash but in fact no ... you're a bash king !
if I understood it well :
first, I save the message in the file descriptor 3
msg=$(mktemp /tmp/msg.XX) || exit 75
cat > $msg || { rm $msg; exit 75; }
exec 3< $msg || { rm $msg; exit 75; }
rm $
On Wed, Dec 21, 2016 at 05:00:19PM +0100, Stéphane MERLE wrote:
> lemail=$(cat)
Instead of buffering the message into a shell variable, buffer it
into a temporary file (and set a "trap" command to delete the file).
You can then inspect the file content before sending the right
message.
It is po
Hi Wietse,
Le 21/12/2016 à 16:46, Wietse Venema a écrit :
St?phane MERLE:
at the top of my bash script I got :
lemail=$(cat)
Aaeeiigghh. Why not let the sendmail command read stdin.
see more explanations below
sendmail -i "$@" "$additional_recipient" < "$msg"
will it work without the "-f
St?phane MERLE:
> at the top of my bash script I got :
>
> lemail=$(cat)
Aaeeiigghh. Why not let the sendmail command read stdin.
> sendmail -i "$@" "$additional_recipient" < "$msg"
>
> will it work without the "-f" ?
If you invoke the script via
pipe ... argv=/path/to/script -f ${sender}
Hi Viktor,
Le 21/12/2016 à 15:02, Viktor Dukhovni a écrit :
On Wed, Dec 21, 2016 at 10:42:37AM +0100, Stéphane MERLE wrote:
when I send the mail content via sendmail :
sendmail -t $nouveau_destinataire <<< $lemail
This is wrong on many levels.
1. It revives *header* recipients, possibl
> On Dec 21, 2016, at 9:10 AM, Ansgar Wiechers wrote:
>
>>3. I has a mysterious "<<<", instead of "<".
>
> `... <<< $var` is bash 4 syntactic sugar for `echo $var | ...`.
An exceedingly bad way to handle message content, especially
sans quotes around "$var".
--
Viktor.
On Wed, Dec 21, 2016 at 10:42:37AM +0100, Stéphane MERLE wrote:
> when I send the mail content via sendmail :
>
> sendmail -t $nouveau_destinataire <<< $lemail
This is wrong on many levels.
1. It revives *header* recipients, possibly creating mail
loops and/or double deliveries. NEV
Hi,
I did manage to pipe my emails to a bash script which filter and push to
an api some emails, but I would like to "forward" some of them to an
email address.
when I send the mail content via sendmail :
sendmail -t $nouveau_destinataire <<< $lemail
or
sendmail $nouveau_destinataire <<< $
Thanks !
just perfect ...
Stéphane
Le 26/11/2016 à 16:13, Wietse Venema a écrit :
St?phane MERLE:
Hi,
Hi,
I found this and it looks just perfect for this !
http://serverfault.com/questions/322657/how-can-i-route-some-emails-to-a-script-in-postfix
one more question, if my script die and c
St?phane MERLE:
> Hi,
>
> Hi,
>
> I found this and it looks just perfect for this !
>
> http://serverfault.com/questions/322657/how-can-i-route-some-emails-to-a-script-in-postfix
>
> one more question, if my script die and cannot process the mail (too
> much cpu or ... script bug), the mail is
Hi,
Hi,
I found this and it looks just perfect for this !
http://serverfault.com/questions/322657/how-can-i-route-some-emails-to-a-script-in-postfix
one more question, if my script die and cannot process the mail (too
much cpu or ... script bug), the mail is lost or will go back in queue ?
H
Hi,
I got a 2 dedicated postfix/dovecot servers that deal with return to
replyto mails. For now, I got a bash script that "read and parse" each
files in /Maildir/new and if it match some criterias (most on
TO/FROM/SUBJECT) send it to another domain mailbox, from that new
domain, the mails are
16 matches
Mail list logo