Many of you have asked how to use email COM objects (ASPMail, JMail, CDO, etc) to send mail in Perl. Here's an example use Win32::OLE; print "COntent-type: text/html\n\n"; sendmail('[email protected]','[email protected]','subject','message'); sub sendmail { my ($from,$to,$subject,$body) = @_; my $m = Win32::OLE->new('JMail.SMTPMail') || die "Can't create JMail.SMTPMail"; $m->{ServerAddress} = 'localhost'; $m->{Subject} = $subject; $m->{Body} = $body; $m->{Sender} = $from; $m->AddRecipient($to); if (! $m->Execute) { warn "mail error $m->{ErrorCode}($m->{ErrorSource}) $m->{ErrorMessage}"; } }
We recently installed a new Perl module that allow you to send mail See http://alma.ch/perl/Mail-Sendmail-FAQ.html quote:Originally posted by bruce Many of you have asked how to use email COM objects (ASPMail, JMail, CDO, etc) to send mail in Perl. Here's an example use Win32::OLE; print "COntent-type: text/html\n\n"; sendmail('[email protected]','[email protected]','subject','message'); sub sendmail { my ($from,$to,$subject,$body) = @_; my $m = Win32::OLE->new('JMail.SMTPMail') || die "Can't create JMail.SMTPMail"; $m->{ServerAddress} = 'localhost'; $m->{Subject} = $subject; $m->{Body} = $body; $m->{Sender} = $from; $m->AddRecipient($to); if (! $m->Execute) { warn "mail error $m->{ErrorCode}($m->{ErrorSource}) $m->{ErrorMessage}"; } } </blockquote id="quote"></font id="quote"> B. DiscountASP.NET http://www.DiscountASP.NET