[Date Prev][Date Next][Thread Prev][Thread Next]
[Search]
[Date Index]
[Thread Index]
Re: [MacPerl-Forum] Filereading into $addresses scalar / simple problem?
On Mon, 15 May 2000 18:00:11 +0200, Jimmy Lantz wrote:
>Hi I'm using the Mail::Sendmail program and I'm trying to take
>emailaddresses from a textfile (see below)
>But it wont work, Any ideas??
>It says there's no recipent.
I snipped so I keep only the relevant portions:
>%mail = ( Bcc => "$bcc",
...
>{
>open(INFO, $datafil);
>@lines = <INFO>;
>close(INFO);
>$bcc = @lines;
Now $bcc is the number of addresses!!!
>}
>###############The datafile contents##########
>webmaster@ostas.lu.se,
>webmaster@ostas.lu.se,
>webmaster@ostas.lu.se,
>webmaster@ostas.lu.se,
The data lines end with a comma!?!?
Don't do that. Add the comma's to join the addresses.
Furthermore, you don't strip the newlines. If you were to join the
addresses correctly, you'd get a header like:
Bcc: number1@domain.com,
number2@domain.com,
number3@domain.com,
That is'nt a correct header. If you insist on line wrapping, and that
isn't a bad idea, then you have to start a continued line with
whitespace (space, tab).
Here's a quick fix:
{
open(INFO, $datafil);
chomp(my @lines = <INFO>);
close(INFO);
$bcc = join ",\n\t", @lines;
}
I assume that the comma's at the end of the data lines got dropped.
--
Bart.
==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-forum-request@macperl.org