Re: Perl/Mail Suggestion....
- From: Sharif Islam <mislam@xxxxxxxxxxxxx>
- Date: Tue, 28 Nov 2006 16:11:49 -0600
amerar@xxxxxxx wrote:
Hi all,
I've just built myself a new server and installed Linux. I currently
have a mailserver rnning Red Hat 9.0 and I'm using Postifx.
My existing server runs just fine. I want to bring my new server
online to test the mail portion without taking down my current server.
I have set up Squirrelmail and that seems to deliver mail just fine.
However, when I try and run a Perl script which uses the Net::SMTP
module, I receive this error:
"Can't call method "mail" on an undefined value at
/prod/scripts/send.pl line 208."
Here is a clip of my code:
$smtp = Net::SMTP->new("nytelife");
$smtp->mail("mail.chicagorsvp.com");
$smtp->to($email);
$smtp->data();
can you make sure you are able to connect to the smtp server?
Try this:
$smtp = Net::SMTP->new("nytelife"); # connect to an SMTP server
if (defined $smtp)
{
$smtp->mail("mail.chicagorsvp.com");
$smtp->to($email);
$smtp->data();
}
else {
print "Cannot to connect to nytelife";
exit;
}
--sharif
.
- References:
- Perl/Mail Suggestion....
- From: amerar@xxxxxxx
- Perl/Mail Suggestion....
- Prev by Date: Re: Date function
- Next by Date: Re: Validation with XSD using XML::LibXML::Schema, and XML::Validator::Schema
- Previous by thread: Re: Perl/Mail Suggestion....
- Next by thread: HTML::TokeParser and Matching
- Index(es):
Relevant Pages
|