#!/usr/bin/perl # Fortune via mail my ($recipients,$fortune,@recipients); # get subscribers open(READ,'/home/bbq/fortune.recipients.txt') || die(); while() { chop; $recipients = push(@recipients,$_); } close(READ); # get fortune $fortune = `fortune`; # compose + send the email open(PIPE,"|/usr/lib/sendmail -t"); print PIPE "From: bbq\@bbq.warp.psi.br (BBQ's Fortune Telling Machine)\n"; print PIPE "To: bbq\@zaz.com.br (A bunch of geeks...)\n"; print PIPE "Bcc: ".join(', ',@recipients)."\n"; print PIPE "Subject: And your fortune for today is...\n\n"; print PIPE "$fortune\n"; print PIPE "Have a nice day!\n"; print PIPE "$recipients people on list.\n"; close(PIPE);