default color: lavender w/red vlinks)
change to: default, lav, whi, gra, ora

Mail-Penguin::Main::Fetch::Redirect::Send Message:
Deliver Via SMTP Host

last updated: Sunday, 24-Jan-1999 02:50:37 EST
[an error occurred while processing this directive]   visit to this page
[ write to Jeff ]

##############################################################
# sub deliver_via_smtp_host -- dependent on behavior of
# SMTP.pm and need stronger error-handling routines.  In
# particular, when sending multiple RCPTs (recipients) for
# a single email, a single 'bad' recipient, rejected by
# the server, aborts the entire send.  In the present code,
# all we're doing about that is 'warning'; there's no
#recovery routine, so the email will not go out to -anyone-
#and no further action will be taken on it.
###############################################################
sub deliver_via_smtp_host {
    local $smtp;
    local $line;
    
    use Net::SMTP;
    $smtp = Net::SMTP->new($smtp_host, Hello => 'localhost',
                                       Timeout => 30 );

# Hmm; I'm not sure this next 'if' statement
# actually works...and there's no 'return' or
# other action provided, if we don't connect...

    if (!$smtp)
    {
        warn "  $smtp_host: not connecting...(smtp = $smtp)\n";
        sleep 2;
    }

    $smtp->mail("From: $header{\"From:\"}");

# If this is outgoing maillist mail, we'll send
# multiple recipient addresses to the SMTP server
# before sending the message itself.

    if ($recipient == 99)  # must be outgoing maillist mail
    {
        foreach $rcvr (@list_addresses)
        {
            $smtp->to("$rcvr") or warn "$rcvr rejected\n";
        }
    }
    else
    {
        $smtp->to("$to_whom");
    }

    $smtp->data();
    while ($line = <TMPMSG>) { $smtp->datasend($line); }
    $smtp->dataend();

    $smtp->quit;

} # end of sub send_via_smtp_host

[ back to Fetch | back to Redirect | back to Send Message ]