foreach(keys %emails) { my ($name, $add1, $add2, $city, $zip, $country) = split(/::/, $ +emails{$_}); # Email Subs, special commands my $editmes = $message; # let's not edit $messa +ge $editmes =~ s/\[name\]/$name/g; #[name] = user name $editmes =~ s/\[time\]/$time/g; #[time] = time sent $editmes =~ s/\[unsub\]/$unsub/g; #[unsub] = unsubscribe +email my $editsig = $signature; # let's not edit $signa +ture $editsig =~ s/\[name\]/$name/g; #[name] = user name $editsig =~ s/\[time\]/$time/g; #[time] = time sent $editsig =~ s/\[unsub\]/$unsub/g; #[unsub] = unsubscribe +email my $editsub = $subject; # let's not edit $subje +ct $editsub =~ s/\[name\]/$name/g; # [name] = user name + open( MAIL, "| $sendmail -t" ); print MAIL "To: $_\n"; print MAIL "From: $adminmail\n"; print MAIL "Subject: $editsub\n\n"; print MAIL "$editmes\n"; if ($use ne "" && $signature ne "" ) { print MAIL "$editsig\n"; } print MAIL ".\n"; close(MAIL); }
The problem with this setup is that, if your mailing list contains a vast quantity of recipients, you put a big load on the system/MTA, for you open a connection for each individual recipient. A "better" way to me, would be the use of one e-mail with the recipients listed in the Bcc field. That would dramastically take some load of the script, for this way, only one connection will be made to $sendmail. The script would be faster too :)
But implementing this Bcc way, would take away the "personalized" e-mails system you implemented (the [name] stuff wouldn't work anymore). It's up to anyone, of course, but I would sacrifice the personal touch over the speed increase and load decrease.
I am interested in your motive that made you write this script though. There are some rather good mailing list programs, such as Majordomo (Perl :), Mailman (Python/C) out there already. Not even mentioning googling.
In reply to Re: Mailing List
by b10m
in thread Mailing List
by sulfericacid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |