[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] smtp



There could be any number of things going wrong.

One is that the mail server isn't accepting the connection, or you 
typed its name wrong, or the dns isn't responding properly, etc.

Check the $smtp variable to ensure everything is set up correctly 
before moving ahead with the rest of the statements.

John



>hello!
>
>
>system configuration: G3, WebStar 4.0, MacPerl 5.2
>
>i'm trying to run script sending form data to an email
>in return such a error mesagge:
>
>"Diagnostic Output
># Can't call method "mail" without a package or object reference."
>
>
>what did i wrong?
>
>
>http://www.rhino.lv/form.html
>
>
>
>
>
>
>
>
>
>
>form.cgi -->
>
>print "Content-type: text/html\n";
>print "Pragma:no-cache\n\n";
>
>
>@querys = split(/&/, $ENV{'QUERY_STRING'});
>foreach $query (@querys) {
>   ($name, $value) = split(/=/, $query);
>   $FORM{$name} = $value;   
>}
>
>read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>@pairs = split(/&/, $buffer);
>
>foreach $pair (@pairs) {
>    ($name, $value) = split(/=/, $pair);
>
>    # Un-Webify plus signs and %-encoding
>    $value =~ tr/+/ /;
>    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>    $value =~ s/<!--(.|\n)*-->//g;
>    $FORM{$name} = $value;
>}
>
>$myemail = 'trakais@rhino.lv';
>
>$vards = "$FORM{'vards'}";
>$valsts = "$FORM{'valsts'}";
>$amats = "$FORM{'amats'}";
>$websaits = "$FORM{'websaits'}";
>$atsauksme = "$FORM{'atsauksme'}";
>$datastring = "nezinu ko te rasktiit!";
>
>
>use Net::SMTP;
>
>         my $smtp = new Net::SMTP(smtp.parks.lv);
>         $smtp->mail($myemail);
>         $smtp->to($myemail);
>         $datastring = "To:$myemail\nSubject: Shitais ir no Weba
>Formas!\r\nNU KO?! SANAACA
>NE?\n$vards\n$valsts\n$amats\n$websaits\n$atsauksme\n";
>         $smtp->data( [ $datastring ] );
>         $smtp->quit;
>
>
>print "<html><head><title>Success</title></head>\n";
>print "<center>\n";
>print "<h2>Kaartibnieks!</h2>\n";
>print "</center></body></html>\n";
>
>
># ===== Want to unsubscribe from this list?
># ===== Send mail with body "unsubscribe" to macperl-request@macperl.org

-- 

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org