hey Perl people!,
Can't seem to get my brain to work this afternoon...
I need to read a file and put it in a $Variable (not @Array).
What I am doing is a bit of code to run a SMTP mail sender (yes, I
know Net::SMTP works great, but this is how the customer want's
it).
So I have something like this (yes, with strict & warnings).
my %Envelope = ( # Envelope bits
-f => "$eMail", # MAIL FROM:
-to => "$eMail" # RCPT TO:
);
GetBodyFromFile(); This is where I am having problems...
SendIt($body, %Envelope);
sub SendIt {
my $body = shift @_; # get the msg body
my $mailer="SMTPmailer.exe"; # the binary (path if needed)
$mailer .= " - @_"; # add all the parms
# now we have something like SMTPmailer.exe - -f [EMAIL PROTECTED] -to [EMAIL PROTECTED]
my $Debug = 1;
print "\nCommand Line = $mailer\nMessage Body = $body\n" if $Debug;
my $SendIt = 0;
open (MAIL, "|$mailer") if $SendIt; # start Blat with all it's parms
print MAIL $body if $SendIt; # now put in the msg body (bigger this way than
CL)
}
This next bit is my problem. I can use the $body in the bit below,
but not the @body. Looks like if I put @body as a parm to SendIt()
above, it comes in a multiples elements of @_ and I get #!perl as the
body, nothing else.
sub GetBodyFromFile {
my $file = $0;
open (INFO, $file);
@body = <INFO>;
close(INFO);
$body="
123456789012345678901234567890123456789012345678901234567890123456789012345678
1 2 3 4 5 6 7";
}
So, how do I get the contents of a multi line file in $body?
Thanks!
--
[EMAIL PROTECTED]
Flying with The Bat! eMail v1.61
Windows 2000 5.0.2195 (Service Pack 2)
Bad command or filename! GO stand in the corner.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]