Re: email from shell with htm attachment

Got it to work with a little pipe trick

cat index.html|/bin/addhead.pl|/sendmail joe [at] test.com

#!/usr/bin/perl -w

use strict;
use warnings;

my $mysubject = join(" ", [at] ARGV);
print<<EOF;
Subject: $mysubject
MIME-Version: 1.0
Content-Type: text/html;
charset="windows-1252"
Content-Transfer-Encoding: quoted-printable
EOF



my $lows;

while (my $line = <STDIN>) {
# $lows = lc($line);
$lows = $line;

print "$lows\n";
}
joe [ Mi, 02 April 2008 14:00 ] [ ID #1933534 ]

Re: email from shell with htm attachment

joe wrote:
> Got it to work with a little pipe trick
>
> cat index.html|/bin/addhead.pl|/sendmail joe [at] test.com
>
> #!/usr/bin/perl -w
>
> use strict;
> use warnings;
>
> my $mysubject = join(" ", [at] ARGV);
> print<<EOF;
> Subject: $mysubject
> MIME-Version: 1.0
> Content-Type: text/html;
> charset="windows-1252"
> Content-Transfer-Encoding: quoted-printable
> EOF
>
>
>
> my $lows;
>
> while (my $line = <STDIN>) {
> # $lows = lc($line);
> $lows = $line;
>
> print "$lows\n";
> }

Or more simply as:

#!/usr/bin/perl
use strict;
use warnings;

print <<EOF, <STDIN>;
Subject: [at] ARGV
MIME-Version: 1.0
Content-Type: text/html;
charset="windows-1252"
Content-Transfer-Encoding: quoted-printable
EOF




John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
someone [ Mi, 02 April 2008 15:11 ] [ ID #1933535 ]
Linux » comp.unix.shell » Re: email from shell with htm attachment

Vorheriges Thema: While loop slowness
Nächstes Thema: how to specify all files of a certain string length in Bourne Shell