Hey David,

Thursday, July 19, 2001, 9:27:19 PM, my MUA believes you used
Internet Mail Service (5.5.2653.19) to write:

ND> Hi,

ND> When I use the following script to send mail: 

ND> #!perl -w
use Strict; # here?
use Diagnostics; # here?

ND> ### script name "smtp_mailer2.pl"
ND> use Net::SMTP;

$smtp = Net::SMTP->>new('mailhost');
does mailhost resolve? or do you change it on your real code to point
to a real SMTP mail server?
$smtp->>mail($ENV{USER});
$smtp->>to('dnazary');
$smtp->>data();
I also put in something like this
  $smtp->>datasend("From: $ENV{USER}\n");
$smtp->>datasend("To: dnazary\n");
$smtp->>datasend("\n");
$smtp->>datasend("A simple test message\n");
$smtp->>dataend();
$smtp->>quit;

ND> I get this error message. Any ideas how I can resolve this? 

You are getting multiple errors here.  I would suggest you pull the
mail part out into it's own program and run it, then you can identify
if it is actually the mail part giving you problems.

C:\CM\utils>>c:\perl\bin\perl  smtp_mailer2.pl
ND> The system cannot find the path specified.
ND> Use of uninitialized value in scalar assignment at
ND> c:/Perl/site/lib/Net/Domain.pm line 191.
ND> Use of uninitialized value in scalar assignment at
ND> c:/Perl/site/lib/Net/Domain.pm line 191.
ND> Use of uninitialized value in pattern match (m//) at
ND> c:/Perl/site/lib/Net/Domain.pm line 215.
ND> Use of uninitialized value in split at c:/Perl/site/lib/Net/Domain.pm line
ND> 219.

Here is my code I use all the time.

<code>

#!/perl -w
use Strict;
use Diagnostics;
use Net::SMTP;

my $SMTPserver = "10.11.145.101";
my $MailTo = "Tim\@Musson.net";
my $Subject = "Subject:SMTP Message from Perl";
my $MessageBody = "Whatever you want in the message";

&sendMail();

sub sendMail {
    my $smtp = Net::SMTP->new($SMTPserver);
    $smtp->mail($MailTo); # envelope bits
    $smtp->to($MailTo); # envelope bits
    $smtp->data(); # Now for the message itself
    $smtp->datasend("From: $MailTo\n");
    $smtp->datasend("To: $MailTo\n");
    $smtp->datasend("$Subject\n\n");
    $smtp->datasend("$MessageBody");
    $smtp->dataend(); # end the message
    $smtp->quit;
}

</code>

-- 
[EMAIL PROTECTED]
Using The Bat! (http://www.ritlabs.com/the_bat/) eMail v1.53d
Windows NT 5.0.2195 (Service Pack 1)
What color is a chameleon on a mirror?


NetZero Platinum
No Banner Ads and Unlimited Access
Sign Up Today - Only $9.95 per month!
http://www.netzero.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to