On Sat, 4 Mar 2017, Viktor Dukhovni wrote:
This is much too complex. To attach email message to another message,
just pipe it through the shell script below my signature. This can
be used as part of a pipe(8) transport with the output submitted via
sendmail(1) for delivery.
Thanks a lot. That's what I searched for and it is working fine ATM.
That's what I did:
In /etc/postfix/virtual the e-mail address directs to a name defined in
/etc/aliases:
caps: "|/etc/postfix/encapsulatemail f...@email.tld o...@email.tld
t...@email.tld"
The simple script is
----
#!/usr/bin/perl -w
use strict;
undef $/;
die if @ARGV < 2;
my $text = <STDIN>;
my $from = shift @ARGV;
my $sendmail = "/usr/sbin/sendmail -f $from ".join(" ", @ARGV);
open MAIL,"|-",$sendmail or die;
my $bounce = ($text =~ /delivery[ -](status|report)/i) ? "bounce " : "";
my $subject = ($text =~ /Subject: (.*)/) ? " [$1]" : "";
print MAIL "From: $from\n"
. "To: ".join(",",@ARGV)."\n"
. "Subject: Encapsulated ${bounce}mail$subject\n"
. "MIME-Version: 1.0\n"
. "Message-ID: <".(time)."_${$}\@encapsulatemail>\n"
. "Content-Type: message/rfc822\n\n$text";
----
As long as nobody starts spamming that addresses this solution will be
fine. :-)
Security note: The f...@email.tld should not go back to the original input
address...
Ciao
--
http://www.dstoecker.eu/ (PGP key available)