Code Comments
Programming Forum and web based access to our favorite programming groups.Hello I have a program that outputs html. When i do program |mail -s "test" joe@test.com My email client outputs the html code on the screen if I do program|uuencode index.htm |mail -s "test" joe@test.com I get the uuencode on the screen but i cant read the html currently i am using program > test.htm mutt -a test.htm joe@test.com <"." is there a way to do this without having to write the file to disk? I have tried the same actions with many email clients and I get the same error over and over. May be i need to put something in the header of the output the script. ANy suggestions? thanks.
Post Follow-up to this messageGot it to work with a little pipe trick
cat index.html|/bin/addhead.pl|/sendmail joe@test.com
#!/usr/bin/perl -w
use strict;
use warnings;
my $mysubject = join(" ",@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";
}
Post Follow-up to this messagejoe wrote:
> Got it to work with a little pipe trick
>
> cat index.html|/bin/addhead.pl|/sendmail joe@test.com
>
> #!/usr/bin/perl -w
>
> use strict;
> use warnings;
>
> my $mysubject = join(" ",@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: @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
Post Follow-up to this messageJust noticed that I had to remove Content-Transfer-Encoding: quoted-printable On Apr 2, 9:11 am, "John W. Krahn" <some...@example.com> wrote: > joe wrote: > > > > > > > > > Or more simply as: > > #!/usr/bin/perl > use strict; > use warnings; > > print <<EOF, <STDIN>; > Subject: @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
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.