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. NEVER do that. 2. It forgets to use "-i" so that leading "." characters in the body are handled correctly. 3. I has a mysterious "<<<", instead of "<". 4. You don't mention what "$lemail" is. The solution is to pass the original envelope recipients to the script via a final ${recipient} parameter to pipe(8) and extend that list by adding another argument (one per additional recipient): # No need to buffer the message if you're not # modifying it! Instead, just let sendmail(1) # below read the input stream directly. msg=$(mktemp /var/tmp/msg.XXXXXX) && cat > "$msg" || exit 75 sendmail -i "$@" "$additional_recipient" < "$msg" This assumes that pipe(8) has argv set correctly: pipe unix ... pipe user=nobody null_sender= flags= argv=/script/path -f $sender -- $recipient (don't remove the space between "-f" and "$sender"!) -- Viktor.