OK. Here is the error message. I stepped through the code to get this. My source file is after that. Names have been changed to protect the guilty
This was working perfectly with the older versions of SMTP.pm which did not use Authen:SASL. If you change your mail server, username and password, it should work with the older smtp.pm, but not the newer version.
Net::SMTP::auth(/usr/share/perl/5.8/Net/SMTP.pm:114):
114: die "auth(username, password)" if not length $username;
DB<2> n
Net::SMTP::auth(/usr/share/perl/5.8/Net/SMTP.pm:115):
115: $sasl = Authen::SASL->new(mechanism=> $mechanisms,
116: callback => { user => $usernam
+e,
117: pass => $passwor
+d,
118: authname =>
$username,
DB<2> n
Net::SMTP::auth(/usr/share/perl/5.8/Net/SMTP.pm:124):
124: my $client =
$sasl->client_new('smtp',${*$self}{'net_smtp_host'},0); DB<2> n
Net::SMTP::auth(/usr/share/perl/5.8/Net/SMTP.pm:124):
124: my $client =
$sasl->client_new('smtp',${*$self}{'net_smtp_host'},0); DB<2> n
Unknown callback: 'authname'. (user|auth|language|pass)
Authen::SASL::client_new('Authen::SASL=HASH(0x856fa78)', 'smtp'
+,
'outgoing.verizon.net', 0) called at /usr/share/perl/5.8/Net/SMTP.pm l
+ine
124
Net::SMTP::auth('Net::SMTP=GLOB(0x850980c)', 'nnigam', 'mypassw
+ord')
called at posturl.pl line 103
Debugged program terminated. Use q to quit or R to restart,
use O inhibit_exit to avoid stopping after program termination,
h q, h R or h O to get additional info.
My Source file
#!/usr/bin/perl
#####################################################################
# File: posturl.pl #
# Version: 1.0.0 #
# For: Personal #
# Language: Perl 5.004_04 #
# Author: Neeraj C. Nigam #
# Date: May 12, 2003 #
# Purpose : #
# Revision History: #
#####################################################################
use strict;
#use ncn::sfunc ;
#use ncn::taps ;
use Net::SMTP;
my($par1,$par2) = (uc($ARGV[0]),$ARGV[1]) ; # Expects a slash at the
+end if directory
$par1 = $par1 || "AB";
$par2 = $par2 || "XXX";
my ($smtp);
my ($mailSrc)="XXX";
my ($sndr)="Bill Gates";
my ($qryStr,$datLen);
my (@aMain);
my ($nmPar,$nmValue);
my ($msgdat)="";
my ($web)=1;
if ( $par1 eq "X" ) {
$web=0;
if ( $par2 ne "" ) {
$mailSrc=$par2;
}
}
open (LOG,">>log.txt");
print LOG "New Record\n";
# Reading from Web Site Begin
if ( $web ) {
$datLen=$ENV{'CONTENT_LENGTH'};
read (STDIN, $qryStr, $datLen);
@aMain=split(/&/,$qryStr);
print "Content-Type: text/html\n\n";
foreach (@aMain){
($nmPar,$nmValue)=split(/=/,$_);
$nmValue =~ tr/+/ /;
$nmValue =~ s/%([\dA-Fa-f][\dA-Fa-f])/ pack ("C", hex($1))/eg;
print "$nmPar = $nmValue<br>\n";
if ($msgdat eq ""){
$msgdat=$nmPar . "=" .$nmValue. "\n" ;
} else {
$msgdat=$msgdat . $nmPar . "=" .$nmValue. "\n" ;
}
#print "$nmValue<br>\n";
print LOG "$nmPar = $nmValue\n";
if ($nmPar eq "fEMail") {
$mailSrc=$nmValue;
}
}
print "<br><br>\n\n";
print $msgdat;
# Read from Website End
} else {
$nmValue="Bill.Gates\@microsoft.com";
$msgdat="Email =" . $nmValue . "\n" ;
$nmValue="Bill Gates";
$msgdat=$msgdat . "Name =" . $nmValue . "\n" ;
$nmValue="Redmond, Washington";
$msgdat=$msgdat . "Add1 =" . $nmValue . "\n" ;
$nmValue="";
$msgdat=$msgdat . "Add2 =" . $nmValue . "\n" ;
$nmValue="Redmond";
$msgdat=$msgdat . "City =" . $nmValue . "\n" ;
$nmValue="WA";
$msgdat=$msgdat . "State =" . $nmValue . "\n" ;
$nmValue="00000-0000";
$msgdat=$msgdat . "Zip =" . $nmValue . "\n" ;
$nmValue="000-000-0000";
$msgdat=$msgdat . "Phone =" . $nmValue . "\n" ;
$nmValue="Mail";
$msgdat=$msgdat . "Contact by Email\n" ;
$nmValue="Your dad asked me to contact you Are you interested";
$msgdat=$msgdat . "Msg =" . $nmValue . "\n" ;
print LOG $msgdat;
}
#$smtp = Net::SMTP->new('smtpout.bellatlantic.net'); #mail host
$smtp = Net::SMTP->new('outgoing.verizon.net',Debug=>1);
#$smtp = Net::SMTP->new('outgoing.verizon.net');
if ($smtp eq ""){
print "Error connecting to Mail server\n";
print "Your message has not been sent\n";
die;
}
$smtp->auth('nnigam','password');
if ($mailSrc eq "XXX") {
$smtp->mail('nnigam@verizon.net');
} else {
$smtp->mail($mailSrc);
}
$smtp->to('pratibha@pntravels.com');
$smtp->data();
$smtp->datasend("Subject: WebFormData\n");
$smtp->datasend($msgdat);
# Try to Add Env Info
#my (@env_rep)=split(/,/,$query{'env_report'} || '');
#my ($env);
#foreach $env (@env_rep) {
# $smtp->datasend("$env: $ENV{$env}\n") or &smtperror;
#}
for (keys %ENV){
$smtp->datasend("$_: $ENV{$_}\n") or &smtperror;
}
$smtp->dataend();
$smtp->quit();
print "Your message has been sent\n";
print "<form method='get' action='/index.html'><br>";
print "<input type='submit' value='Press to Return'><br>";
print "</form>";
close(LOG);
|