Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl/Mail Suggestion....

Reply
Thread Tools

Perl/Mail Suggestion....

 
 
amerar@iwc.net
Guest
Posts: n/a
 
      11-28-2006
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();

That is the code that currently runs on the Red Hat 9.0 existing
server. I am wondering if this is a problem due to hostnames or
something. I'm just lost and have no idea where to look.......

Can anyone help or offer a suggestion?

Thanks!

 
Reply With Quote
 
 
 
 
amerar@iwc.net
Guest
Posts: n/a
 
      11-28-2006

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();
>
> That is the code that currently runs on the Red Hat 9.0 existing
> server. I am wondering if this is a problem due to hostnames or
> something. I'm just lost and have no idea where to look.......
>
> Can anyone help or offer a suggestion?
>
> Thanks!


I have another question:

In line #2: $smtp->mail("mail.chicagorsvp.com");

Where is that mail server definition defined? I'll need to change the
name on the new server so there is no conflict......

Thanks!

 
Reply With Quote
 
 
 
 
amerar@iwc.net
Guest
Posts: n/a
 
      11-29-2006

Sharif Islam wrote:
> 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


Hmm....says it cannot connect, even though Postfix IS running and I can
send email internally.......

Any thoughts?

I've shutdown postfix on my other server, and I've changed my
forwarding on my router to forward posts 25 & 113 to the new
machine........

 
Reply With Quote
 
amerar@iwc.net
Guest
Posts: n/a
 
      11-29-2006

Sharif Islam wrote:
> 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


I meant to say ports 25 & 110.......

 
Reply With Quote
 
Ric
Guest
Posts: n/a
 
      11-29-2006
schrieb:
> Sharif Islam wrote:
>> 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

>
> Hmm....says it cannot connect, even though Postfix IS running and I can
> send email internally.......
>
> Any thoughts?
>
> I've shutdown postfix on my other server, and I've changed my
> forwarding on my router to forward posts 25 & 113 to the new

110 is only for pop and postfix does no pop
> machine........
>


so your mailservers hostname is: mail.chicagorsvp.com ?

If it is you should be able to telnet to it:

telnet mail.chicagorsvp.com 25

You should see the postfix response message. Now you can type:

EHLO chicagorsvp.com

You should see response ok. Type:

MAIL FROM: youremailadress

You should see ok. Type

RCPT TO: emailadress

You should see ok. Type

DATA

Mailserver responds: enter mail. Type your mail

dfssadfa

then newline . exit

depending ony what kind of mailadresses you used and how you configured
the mailserver may reject your message. If you don't even see the
initial postfix responce, then try with the ip of your machine.


 
Reply With Quote
 
amerar@iwc.net
Guest
Posts: n/a
 
      11-29-2006

Ric wrote:
> schrieb:
> > Sharif Islam wrote:
> >> 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

> >
> > Hmm....says it cannot connect, even though Postfix IS running and I can
> > send email internally.......
> >
> > Any thoughts?
> >
> > I've shutdown postfix on my other server, and I've changed my
> > forwarding on my router to forward posts 25 & 113 to the new

> 110 is only for pop and postfix does no pop
> > machine........
> >

>
> so your mailservers hostname is: mail.chicagorsvp.com ?
>
> If it is you should be able to telnet to it:
>
> telnet mail.chicagorsvp.com 25
>
> You should see the postfix response message. Now you can type:
>
> EHLO chicagorsvp.com
>
> You should see response ok. Type:
>
> MAIL FROM: youremailadress
>
> You should see ok. Type
>
> RCPT TO: emailadress
>
> You should see ok. Type
>
> DATA
>
> Mailserver responds: enter mail. Type your mail
>
> dfssadfa
>
> then newline . exit
>
> depending ony what kind of mailadresses you used and how you configured
> the mailserver may reject your message. If you don't even see the
> initial postfix responce, then try with the ip of your machine.


Hmm...tried your suggestion, here is the output:

[root@nytelife scripts]# telnet mail.chicagorsvp.com 25
Trying 206.126.253.242...
telnet: connect to address 206.126.253.242: Connection refused

And, I have IPTABLES running, but I've enabled ports 110 & 25:

ACCEPT tcp -- anywhere anywhere state NEW
tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere state NEW
tcp dptop3

Any suggestions? This is weird as I copied config files from a working
server.....

 
Reply With Quote
 
amerar@iwc.net
Guest
Posts: n/a
 
      11-29-2006

Ric wrote:
> schrieb:
> > Sharif Islam wrote:
> >> 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

> >
> > Hmm....says it cannot connect, even though Postfix IS running and I can
> > send email internally.......
> >
> > Any thoughts?
> >
> > I've shutdown postfix on my other server, and I've changed my
> > forwarding on my router to forward posts 25 & 113 to the new

> 110 is only for pop and postfix does no pop
> > machine........
> >

>
> so your mailservers hostname is: mail.chicagorsvp.com ?
>
> If it is you should be able to telnet to it:
>
> telnet mail.chicagorsvp.com 25
>
> You should see the postfix response message. Now you can type:
>
> EHLO chicagorsvp.com
>
> You should see response ok. Type:
>
> MAIL FROM: youremailadress
>
> You should see ok. Type
>
> RCPT TO: emailadress
>
> You should see ok. Type
>
> DATA
>
> Mailserver responds: enter mail. Type your mail
>
> dfssadfa
>
> then newline . exit
>
> depending ony what kind of mailadresses you used and how you configured
> the mailserver may reject your message. If you don't even see the
> initial postfix responce, then try with the ip of your machine.


Also, I ran netstat. I'm not sure if this is correct or not, so maybe
someone can look and tell me of the Port 25 entry is correct?


[root@nytelife scripts]# netstat -atn |grep LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:907 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:783 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:*
LISTEN
tcp 0 0 :::993 :::*
LISTEN
tcp 0 0 :::995 :::*
LISTEN
tcp 0 0 :::110 :::*
LISTEN
tcp 0 0 :::143 :::*
LISTEN
tcp 0 0 :::80 :::*
LISTEN
tcp 0 0 :::443 :::*
LISTEN

 
Reply With Quote
 
Ric
Guest
Posts: n/a
 
      11-29-2006

>
> Hmm...tried your suggestion, here is the output:
>
> [root@nytelife scripts]# telnet mail.chicagorsvp.com 25
> Trying 206.126.253.242...
> telnet: connect to address 206.126.253.242: Connection refused


and 206.126.253.242 is the ip of your new mailserver?
>
> And, I have IPTABLES running, but I've enabled ports 110 & 25:
>
> ACCEPT tcp -- anywhere anywhere state NEW
> tcp dpt:smtp
> ACCEPT tcp -- anywhere anywhere state NEW
> tcp dptop3
>
> Any suggestions? This is weird as I copied config files from a working
> server.....


well that may be the problem, depending on what you copied and depending
on your network setup
>


Without knowing your whole network setup this is difficult to check if
everything is okay, you may need forwarding rules etc.

Just run the telnet commands I told you earlier on your new mailserver
(mail.chicagorsvp.com)

on that machine in a konsole:

telnet localhost 25

If that works you know this machine is okay and you have a
network/firewal problem.

But this is definitely not the appropriate mailinglist for your problem.


 
Reply With Quote
 
amerar@iwc.net
Guest
Posts: n/a
 
      11-29-2006

Ric wrote:
> >
> > Hmm...tried your suggestion, here is the output:
> >
> > [root@nytelife scripts]# telnet mail.chicagorsvp.com 25
> > Trying 206.126.253.242...
> > telnet: connect to address 206.126.253.242: Connection refused

>
> and 206.126.253.242 is the ip of your new mailserver?
> >
> > And, I have IPTABLES running, but I've enabled ports 110 & 25:
> >
> > ACCEPT tcp -- anywhere anywhere state NEW
> > tcp dpt:smtp
> > ACCEPT tcp -- anywhere anywhere state NEW
> > tcp dptop3
> >
> > Any suggestions? This is weird as I copied config files from a working
> > server.....

>
> well that may be the problem, depending on what you copied and depending
> on your network setup
> >

>
> Without knowing your whole network setup this is difficult to check if
> everything is okay, you may need forwarding rules etc.
>
> Just run the telnet commands I told you earlier on your new mailserver
> (mail.chicagorsvp.com)
>
> on that machine in a konsole:
>
> telnet localhost 25
>
> If that works you know this machine is okay and you have a
> network/firewal problem.
>
> But this is definitely not the appropriate mailinglist for your problem.


Well, problem turned out to be that port 25 was open to 127.0.0.1 only,
as you can see above. Once I changed the port to be open on all
interfaces, it worked. It still does not explain the 3 colons (:: on
the other ports......that's kind of weird......

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57