Perl script to send e-mail
#!/bin/perl
# Build an array of e-mail addresses to be Bcc'd to
my @bcc_addresses = (
'foo@bar.com',
'foo@bar2.com');
# The main recipient
my $to='foofoo@bar.com';
# Join the bcc addresses from the array, separate with comma
my $bcc = join(", ", @bcc_addresses);
# Where it's coming from
my $from='miguel@foobar.com';
# e-mail Subject
my $subject="Perl mail example";
# The e-mail content follows
my $out = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Nullam vestibulum dictum lectus.
Etiam at sapien. Donec fermentum dictum nisi. In ornare adipiscing massa.";
# Now let's fire up sendmail and push the data into it, then send
open(MAIL, "|/usr/sbin/sendmail -t");
print MAIL "To: $to\n";
print MAIL "Bcc: $bcc\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n";
print MAIL $out;
close(MAIL);
