@users = &Get_Users_from_Db("$some_db"); while ( defined($usr = shift(@users)) ) { chomp($usr); # # Assume the rcpt and send methods appropriatly process the # reponse from the server also here we would add error # checking for properly formated email addie. # $smtp->rcpt("$usr"); $cc_head ? $cc_head .= ", $usr" : $cc_head = "$usr"; } print $smtp->send("DATA"); # # At this point we talk directly to the socket because the # smtp server does not repond with anything till we are done # $socket = $smtp->socket(); print $socket "From: $from\n"; print $socket "To: $list_name\n"; print $socket "CC: $cc_head\n" if ($CC && $cc_head); print $socket "Subject: $subject\n\n"; print $socket "@message_body\n\n"; $ok = $smtp->send('.'); &Some_Error_Routine("sending mail") if (!$ok);