Perl/Mail Suggestion....

A

amerar

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!
 
A

amerar

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!
 
A

amerar

Sharif said:
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........
 
A

amerar

Sharif said:
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.......
 
R

Ric

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.
 
A

amerar

Ric said:
110 is only for pop and postfix does no pop:)

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 dpt:pop3

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

amerar

Ric said:
110 is only for pop and postfix does no pop:)

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
 
R

Ric

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 dpt:pop3

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.
 
A

amerar

Ric said:
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 dpt:pop3

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......
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Perl e-mail problem 1
Net::SMTP errors 3
Problem with SMPT mail 4
Perl and SMTP mail problems 1
Mail::Sender problem 3
My Perl scripts don't run anymore 5
FAQ 9.20 How do I send mail? 3
Net::SMTP problem 1

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top