Ask a Question related to PERL Miscellaneous, Design and Development.
-
Erik Waibel #1
Net::SMTP
Hello,
I'm trying to send mail using the Net::SMTP module, but am having
difficulties. I'm not using Perl, I'm using "ccperl", which comes with
ClearCase. So I'm limited to the mail modules that came standard with the
installation: Mail::Mailer, Mail::Mailer::sendmail, Net::SMTP... Here's my
code:
use Net::SMTP;
sub send_mail
{
$send_to = 'someone@someplace.com';
$server = 'my_server.com';
$smtp = new Net::SMTP ('host', Hello=>$server);
$smtp->mail($ENV{USER});
$smtp->to($send_to);
$smtp->data();
$smtp->datasend("To: whomever");
$smtp->datasend("\n");
$smtp->datasend("Test");
$smtp->dataend();
$smtp->quit;
}
This is the error:
%cmd> ccperl cclibrpt.pl
"connect: The requested address is not valid in its context.
at cclibrpt.pl line 149"
The line being referred to is the $smtp = new... line
-- -------
Thanks,
Erik Waibel
----------
Perl Hacker v.1.0
Erik Waibel Guest
-
CDO and SMTP
I want to use the CDO instead of CDONTS running via Server 2003. Within the sample code it asks for the SMTP server name. Once I've installed the... -
PHP 5 & SMTP
Anyone know if PHP 5 has built in support for communicating with SMTP servers that require a username and password? Right now, as everyone knows,... -
SMTP for ASP
Hi Group, I'm having a few problems with getting an SMTP server configured on my Windows 2000 Server web server. My web server is co-located at my... -
How to set sendmail SMTP auth and SMTP SSL on Solaris 9 (x86)
Dear all, Can anybody tell me how to set sendmail SMTP auth and SMTP SSL on Solaris 9(x86). Thanks! -
SMTP
I am having a problem with sending mail via system.web.mail. When I send the file shows up in the queue folder so something is not letting it go,... -
Sqrex #2
Net::SMTP
Hi.
I`ve got problem with module Net::SMTP. I want to check my SMTP server
is working proparly so i run this script:
#!/usr/bin/perl -w
use Net::SMTP;
$smtp = Net::SMTP -> new('100.100.100.100',
Hello => 'my_name.ma_domain',
Timeout => 10,
Debug => 1
);
$smtp->mail('admin@');
$smtp->to('postmaster');
$smtp->quit;
Debug:
bash-3.00# ./sesja_smtp1.pl
Can't call method "mail" on an undefined value at ./sesja_smtp1.pl line
9.
I want to write to log some memo when my SMTP server don`t answer to
any of this commands.
Is it possible ?
I found something like that in documentation:
"Unless otherwise stated all methods return either a true or false
value, with true meaning that the operation was a success. When a
method states that it returns a value, failure will be returned as
undef or an empty list."
But i don`t know how to use it with if ore while commands.
Thx for help.
Sqrex Guest
-
Andrzej Adam Filip #3
Re: Net::SMTP
"Sqrex" <sqrex@poczta.fm> writes:
> Hi.
> I`ve got problem with module Net::SMTP. I want to check my SMTP server
> is working proparly so i run this script:
> #!/usr/bin/perl -w
>
> use Net::SMTP;
> $smtp = Net::SMTP -> new('100.100.100.100',
> Hello => 'my_name.ma_domain',
> Timeout => 10,
> Debug => 1
> );
>
>
> $smtp->mail('admin@');
> $smtp->to('postmaster');
> $smtp->quit;
>
> Debug:
> bash-3.00# ./sesja_smtp1.pl
> Can't call method "mail" on an undefined value at ./sesja_smtp1.pl line
> 9.
use Net::SMTP;
$smtp = Net::SMTP -> new('100.100.100.100',
Hello => 'my_name.ma_domain',
Timeout => 10,
Debug => 1
);
if( !defined($smtp)){
# $smtp object have not been created. Problem report is in $@
die $@;
}
> [...]
--
[pl2en: Andrew] Andrzej Adam Filip : [email]anfi@priv.onet.pl[/email] : [email]anfi@xl.wp.pl[/email]
Andrzej Adam Filip Guest
-
Sqrex #4
Re: Net::SMTP
this work but there is another problem. when i receive error message
program ends and i want it to go to next command not to end.
it ends with error:
Net::SMTP: connect: timeout (this is from print $@)
Can't call method "mail" on an undefined value at ./smtp.pl line 11.
end it ends :/
$smtp->mail("test\@test.com");> use Net::SMTP;
> $smtp = Net::SMTP -> new('100.100.100.100',
> Hello => 'my_name.ma_domain',
> Timeout => 10,
> Debug => 1
> );
>
> if( !defined($smtp)){
> # $smtp object have not been created. Problem report is in $@
> print $@;
> }
Sqrex Guest



Reply With Quote

