gary kuipers has asked for the wisdom of the Perl Monks concerning the following question:
use Net::SMTP; sSendEmail('validrecipient@validdomain.com','validrecipient@validdomai +n.com','ssssssubject','bbbbbbody'); sub sSendEmail { my ($to,$from,$subject,@body) = @_; my $smtp = Net::SMTP->new('mail.validdomain.com', Debug => 1); die "Could not open SMTP connection $!" if (! defined $smtp); print "Connected to: ", $smtp->domain. "\n"; $smtp->auth('garykuipers@ondacom.biz','judge'); print "debug:before recipient\n"; $smtp->recipient($to); print "debug:after recipient\n"; $smtp->mail($from); $smtp->data(); $smtp->datasend("To: $to\n"); $smtp->datasend("From: $from\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); foreach my $line (@body) { $smtp->datasend("$line\n"); } print "debug:before dataend\n"; $smtp->dataend(); print "debug:before quit\n"; $smtp->quit; print "debug:after quit\n"; print "Mail sent to: |$to|\n"; }
Edit by dws to use <code> tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SMTP generates unexpected errors in Debug Mode
by pg (Canon) on Dec 22, 2002 at 20:41 UTC | |
|
Re: Net::SMTP generates unexpected errors in Debug Mode
by poj (Abbot) on Dec 22, 2002 at 21:00 UTC | |
by gary kuipers (Beadle) on Dec 22, 2002 at 23:26 UTC | |
by ChunkyMonk (Initiate) on Dec 23, 2002 at 01:11 UTC |