Re: attaching a document
Xavier GROSJEAN (xagrosje@capgemini.fr)
Fri, 25 Feb 2000 17:00:48 +0100
Just in case the other answer were a bit short, here is what you can do:
Generating an email :
$subject, $from and $msg should be definied somewhere.
To attach a document, you should uuencode it with the uuencode utility, =
it
will give you a huge string that you include into your message $msg.
It will be seen as a Mime document and decoded accordingly by the mail =
reader
it has the ability to do it (displaying it as an attached document)
use HTTP::Request;
use HTTP::Response;
use LWP::UserAgent;
my $acces =3D new LWP::UserAgent('mail.pl');
my $requete =3D new HTTP::Request(POST =3D> "mailto:$to");
$requete->header(Subject =3D> $subject,
From =3D> $from);
$requete->content($msg);
my $reponse =3D $acces->request($requete) ;
if ($reponse->is_success())
{
# do whatever you like
}
else
{
# same
}=20
-----Message d'origine-----
De : Mueller, Juergen (pro.vider GmbH iG) <juergen.mueller@pro.vider.de>
=C0 : 'libwww@perl.org' <libwww@perl.org>
Date : vendredi 25 f=E9vrier 2000 16:30
Objet : attaching a document
>Hello,
>
>I'm not quite sure if this is the right list for my question, anyway... =
;-)
>
>If one wants to generate an email, the perl-code surely looks something =
like
>that:
>
> open(MAIL,"|$mailprog -t");
>
> print MAIL "To: info\@host.de\n";
> print MAIL "From: $input{'absender'}\n";
> print MAIL "Subject: Hallo Juergen\n\n";
> print MAIL "\n";
> print MAIL "Text der Email\n";
> print MAIL "blabla ...\n\n";
>
> close (MAIL);
>
>
>Questions:
>What is the code to attache a document to such a script-generated =
email?
>
>Thanks a lot.
>
>Juergen