James Sommers wrote:
> I'm very new to apache & perl. I've got apache
> installed and perl installed in c:\perl
> My question is what is the correct way to install the
> sendmail module?
> I'm trying to install mail::sendmail 
> but not sure what the correct way to do it is....
> Different things I have read and tried....
> 1. copy sendmail.pm into the modules dir of perl.
> Tried that and got nothing even after adding the line
> for it in httpsd.conf
> 2. somewhere else I read to download nmake if your
> running apache on a win32 machine.
> So I did that and then did a....
> perl makefile
> nmake
> nmake install
> This seemed like it was going to work and said
> something about it installed the sendmail.pm into
> perl/site/lib/mail/sendmail
> I then added this line in the httpds.conf to reflect
> the above path but when I restart the apache server it
> says that it couldn't load it. 
>  Also have the comanche program installed and tried it
> thru there but wasn't quite sure if this was the way to
> load it....I'm just kinda confused over here about how
> to install this and other modules correctly.
> I've done my research and turn to you guys for expert
> advice...

1) Why use Mail::Sendmail ?  Net::SMTP may already be there or install
MIME::Lite for serious email (uses Net::SMTP).

2) To install a module for AP Perl, use ppm.  Go to perl/bin and type
'perl ppm' - then type 'install <module-name>' (replacing :: with - in
most cases.  You can do it all in one line on cmdline if you like.

3) When you use a module in CGI, Apache has no need to do any config
changes.  Add a 'use MIMI::Lite;' line and follow the calling instructions
given in the pod that comes with the module.  Eg:

use strict;
use MIME::Lite;

MIME::Lite->send('smtp', '<your-smtp-server>', Timeout => 60);

my $msg = MIME::Lite->build(
        From     => '[EMAIL PROTECTED]',
        To       => '[EMAIL PROTECTED]',
        Subject  => 'A test message',
        Type     => 'TEXT',
        Encoding => '7bit',
        Data     => "Just a quick note to say hi!",
);

$msg->send;

__END__

or using Net::SMTP:

use strict;
use Net::SMTP;

my $from = '[EMAIL PROTECTED]';
my $to = '[EMAIL PROTECTED]';
my $msg = <<EOD;
From: $from
To: $to
Reply-To: $from
Subject: SUBJECT GOES HERE
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

this is the message text
EOD

sendmail ($from, $to, $msg);
exit;

sub sendmail {
     my ($from, $to, $msg) = @_;

my $smtphost = 'somehost.com';
$smtphost = 'mail.yourdomain.com';
my $smtp = Net::SMTP->new($smtphost) or die "Net::SMTP::new error: $!";
$smtp->mail($from);
$smtp->to($to);
$smtp->data();
$smtp->datasend($msg);
$smtp->dataend();
}

__END__

-- 
   ,-/-  __      _  _         $Bill Luebkert   ICQ=162126130
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to