there is a   one problem
$mail{message}=<FIN>; only reads the first line of the file
in the following block;

 $oldsep=$/; $/=undef; disable line seperation
 open(FIN,"<myfile>")||die "cannot open file: $!\n";
 $mail{message}=<FIN>;
 close(FIN);
 $/=$oldsep;





try this instedof that line

@file = <FIN>;
chomp @file;
$mail{message}=join("\n",@file);



----- Original Message -----
From: "Gary Stainburn" <[EMAIL PROTECTED]>
To: "Scott, Joshua" <[EMAIL PROTECTED]>; "Beginners Perl"
<[EMAIL PROTECTED]>
Sent: Tuesday, November 05, 2002 11:15 PM
Subject: Re: Mail::Sendmail Module


> On Tuesday 05 Nov 2002 5:01 pm, Scott, Joshua wrote:
> > Hello everyone,
> >
> > I'm trying to use the Mail::Sendmail module in a script where I need a
> > independent mailer.  The problem I'm having is including more than one
line
> > of text in the message body.  I'm not really sure how to do this.  The
> > package uses a $mail{message} = "blah" var for the message body.  Is it
> > possible to get more than one line into that hash value?
> >
> > Basically I've got a script that generates a bunch of information and
> > outputs it to a file.  What I would like to do is make the contents of
this
> > file, the body of my message.  I don't want it as an attachment.
> >
> > Any help is greatly appreciated.
>
> Hi Joshua,
>
> If you simply wanted to create a multi-line message body as a string then
you
> could do something like:
>
> $mail{message}="line1\nline2\nline3\n....";
> or
> $mail{message}=qq{line1
> line2
> line3
> };
>
> If you want to use the contents of a file as the body, use something like.
>
> $oldsep=$/; $/=undef; disable line seperation
> open(FIN,"<myfile>")||die "cannot open file: $!\n";
> $mail{message}=<FIN>;
> close(FIN);
> $/=$oldsep;
>
> It disables the record seperator (newline) then reads the whole file into
the
> hash entry.
>
> >
> > Thank you,
> >
> > Joshua Scott
> > Security Systems Analyst, CISSP
> > 626-568-7024
> >
> >
===========================================================================
> >=========== NOTICE - This communication may contain confidential and
> > privileged information that is for the sole use of the intended
recipient.
> > Any viewing, copying or distribution of, or reliance on this message by
> > unintended recipients is strictly prohibited. If you have received this
> > message in error, please notify us immediately by replying to the
message
> > and deleting it from your computer.
> >
> >
===========================================================================
> >===
>
> --
> Gary Stainburn
>
> This email does not contain private or confidential material as it
> may be snooped on by interested government parties for unknown
> and undisclosed purposes - Regulation of Investigatory Powers Act, 2000
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to