Try this. It's always worked for me in the past:
print "Content-type: text/plain", "\n\n";
my $DEBUG = 0;
if($DEBUG){
$| = 1;
open(STDERR, ">&STDOUT");
}
my $ServerName = "000.000.000.000";
# Create a new SMTP object
my $smtp = Net::SMTP->new($ServerName, Debug => 1);
die "Couldn't connect to server" unless
$smtp;
my $MailFrom = "admin\@domain.com";
my $MailTo = "admin\@domain.com";
$smtp->mail( $MailFrom );
$smtp->to( $MailTo );
# Start the mail
$smtp->data();
# Send the header
# This address will appear in the message
$smtp->datasend("To: Mail Administrator");
$smtp->datasend("From: Online Email?\n");
$smtp->datasend("Subject: New Email\n");
$smtp->datasend("\n");
# Send the body.
# You can place some form info here along with anything
# else you might want to stuff into the email
$smtp->datasend("$fn $ln has registered online\n");
$smtp->dataend();
$smtp->quit();
I have a few moe example if this doesn't work
Mark Bergeron (How's everyone doing out there?)
-----Original Message-----
From: "Carl Jolley"<[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED]
Date: Thu Jun 13 00:04:49 PDT 2002
Subject: Re: Send email in ActivePerl using SMTP
>On Thu, 6 Jun 2002 [EMAIL PROTECTED] wrote:
>
>> I tried the following to use SMTP to send email:
>>
>>
>> use Net::SMTP;
>> $optServer = 'luxn.com';
>> $optFrom = "[EMAIL PROTECTED]";
>> $optTo = "[EMAIL PROTECTED]";
>> $smtp = Net::SMTP -> new ("luxn.com");
>> $smtp -> mail($optFrom);
>> $smtp -> to ($optTo);
>>
>> $smtp -> data();
>>
>> Send the Header
>>
>> $smtp -> datasend ("To: [EMAIL PROTECTED]\n");
>> $smtp -> datasend ("From: [EMAIL PROTECTED]\n");
>> $smtp -> datasend ("\n");
>>
>> Send the body
>>
>> $smtp -> datasend("hello, world!\n");
>> $smtp -> dataend();
>> $smtp -> quit;
>>
>>
>> It say:
>>
>> Can't call method "mail" on an undefined value at
>> mailtest.pl line 8
>>
>> line 8 is: $smtp -> mail($optFrom);
>>
>> I tried: $smtp -> mail('[EMAIL PROTECTED]'); it did not help.
>>
>> What might be wrong here?
>>
>
>Most likely your statement:
>
> $smtp = Net::SMTP -> new ("luxn.com");
>
>failed. Had you checked the result you would have known.
>It probably failed because luxn.com is not the name of the
>host that provides mail service for the domain luxn.com.
>The parameter to the new method must be a hostname, not
>a domain name.
>
>**** [EMAIL PROTECTED] <Carl Jolley>
>**** All opinions are my own and not necessarily those of my employer ****
>
>_______________________________________________
>Perl-Win32-Users mailing list
>[EMAIL PROTECTED]
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___________________________________________________
GO.com Mail
Get Your Free, Private E-mail at http://mail.go.com
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs