LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Fail to telnet localhost 25 (https://www.linuxquestions.org/questions/linux-server-73/fail-to-telnet-localhost-25-a-503782/)

satimis 11-21-2006 10:33 PM

Fail to telnet localhost 25
 
Hi folks,

Ubuntu-6.06.1-LAMP-server-amd64

I followed Section "11 Postfix With SMTP-AUTH And TLS" on
http://www.howtoforge.com/perfect_setup_ubuntu_6.06_p5

to config LAMP server. Encountered problem on running;
$ sudo telnet localhost 25
Code:

Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Ubuntu)

(hanging here sometimes - then popup)

421 server1.example.com Error: timeout exceeded
Connection closed by foreign host.

Please advise how to fix the problem.

TIA


B.R.
satimis

bathory 11-22-2006 01:40 AM

Quote:

(hanging here sometimes - then popup)
It's not hanging. It's waiting for you to start giving smtp commands and after a while it just timeouts. After connecting try something like:
Code:

ehlo yourdomain.com

satimis 11-22-2006 04:05 AM

Hi bathory,

Quote:

It's not hanging. It's waiting for you to start giving smtp commands and after a while it just timeouts. After connecting try something like:
Code:

ehlo yourdomain.com

I got it. It was wasting for my input.

$ sudo /etc/init.d/saslauthd restart
Password:
Code:

Stopping SASL Authentication Daemon: saslauthd.
Starting SASL Authentication Daemon: saslauthd.

$ sudo telnet localhost 25
Code:

Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Ubuntu)

(it was waiting here.  Then I typed)
ehlo localhost
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250 8BITMIME

(it was further waiting here.  Then I typed)
quit
221 Bye
Connection closed by foreign host.

Tks.


B.R.
satimis

bathory 11-22-2006 04:10 AM

You can use the following smtp commands to send an email
Code:

telnet localhost 25
ehlo yourdomain.com
mail from: you@yourdomain.com
rcpt to: recipient@otherdomain.com
data
subject: Whatever subject you want
blah blah
blah blah
.

Always finish your mail with a dot "."

satimis 11-22-2006 05:02 AM

Hi bathory,

Tks for your advice.

Quote:

You can use the following smtp commands to send an email
Code:

telnet localhost 25
ehlo yourdomain.com
mail from: you@yourdomain.com
rcpt to: recipient@otherdomain.com
data
subject: Whatever subject you want
blah blah
blah blah
.

Always finish your mail with a dot "."
I haven't registered a domain yet. How can I perform this test? TIA


B.R.
satimis

bathory 11-22-2006 05:17 AM

Well you can use whatever domain you want (existing or not existing) as yourdomain.com (you can also leave it as is or use localhost) and a valid email address to get the email (replace recipient@otherdomain.com).
But keep in mind that most mailservers do not accept mail from a host who's IP does not resolve to a domain. So you can test it locally (i.e send an email from you to yourself).

satimis 11-22-2006 05:46 AM

Hi bathory,

Quote:

Well you can use whatever domain you want (existing or not existing) as yourdomain.com (you can also leave it as is or use localhost) and a valid email address to get the email (replace recipient@otherdomain.com).
But keep in mind that most mailservers do not accept mail from a host who's IP does not resolve to a domain. So you can test it locally (i.e send an email from you to yourself).
Performed 2 tests as follows;

1)
$ telnet localhost 25
Code:

Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Ubuntu)
ehlo satimis.com
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250 8BITMIME
mail from:myself@satimis.com
250 Ok
rcpt to: satimis@abc.com
250 Ok
data
354 End data with <CR><LF>.<CR><LF>
subject: Test
this is a test.  This is a test, a test, a test
.
250 Ok: queued as 91384754034

(It is waiting here.  What shall I input?)
421 server1.example.com Error: timeout exceeded
Connection closed by foreign host.

Failed.


2)
$ sudo telnet localhost 25
Password:
Code:

Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Ubuntu)
ehlo satimis.com
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250 8BITMIME
mail from: myself@satimis.com
250 Ok
rcpt to: satimis@abc.com
250 Ok
data
354 End data with <CR><LF>.<CR><LF>
subject:Test
This is a test, a test, a test
<CR><LF>.<CR><LF>
.
250 Ok: queued as BD396754040

(It is still waiting here}

Also failed

Furthermore sending a email to myself I still have to going through ISP. I think I have to register a free domain to continue this test.

Tks.

B.R.
satimis

bathory 11-22-2006 06:06 AM

Quote:

(It is still waiting here}
After the dot that end the mail data you must give quit to quit the telnet session.
Instead of rcpt to: satimis@abc.com (I guess it's not real), why don't you use rcpt to: satimis@localhost to see if you can send/receive locally (assuming the user satimis exists) and use whatever account you have in webmail services like gmail, hotmail etc to see if you can send outside your box.

satimis 11-22-2006 06:33 AM

Hi bathory,

Further test;

$ telnet localhost 25
Code:

Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Ubuntu)
ehlo satimis.com
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250 8BITMIME
mail from: myself@satimis.com
250 Ok
rcpt to: satimis@localhost
250 Ok
data
354 End data with <CR><LF>.<CR><LF>
subject: Test
This is a test, a test, a test
.
250 Ok: queued as CEAE9754049
quit
221 Bye
Connection closed by foreign host.
You have new mail in /var/mail/satimis

$ nano /var/mail/satimis

Yes I received the mail.


Also sent it to webmail a/c on yahoo.com. But up to the time of writing I haven't received it.


Others noted with tks.


B.R.
satimis

bathory 11-22-2006 07:00 AM

Quote:

Also sent it to webmail a/c on yahoo.com. But up to the time of writing I haven't received it.
Most likely you're not going to receive it since your IP must resolve to a valid hostname. If that's not true the other mailserver rejects the message to prevent spam.

Regards

Quigi 11-22-2006 12:09 PM

Quote:

Originally Posted by satimis
Also sent it to webmail a/c on yahoo.com. But up to the time of writing I haven't received it.

Quote:

Originally Posted by bathory
Most likely you're not going to receive it since your IP must resolve to a valid hostname. If that's not true the other mailserver rejects the message to prevent spam.

Yes, Yahoo is picky. To see yourself what your mailer is encountering, you can talk to them just like you talk to your own SMTP server:
Code:

telnet a.mx.mail.yahoo.com 25
Normally you get "Message temporarily deferred", and the door slammed in your face. It's not really temporary -- it'll never work. See http://help.yahoo.com/help/us/mail/defer/defer-06.html
To fix, go to http://add.yahoo.com/fast/help/us/mail/cgi_defer and tell them your IP address is not "naughty". Yes, they take your word for it. Since I told then that my IP was "nice", their SMTP server has been polite, and I just sent myself a mail.

You reported this experiment:
Code:

354 End data with <CR><LF>.<CR><LF>
subject: Test
This is a test, a test, a test
.

"Subject" should be capitalized. And there should be an empty line between the headers (Subject, Date, From, To, ...) and the body of the message.
Quote:

Originally Posted by http://www.ietf.org/rfc/rfc2822
A message consists of header fields (collectively called "the header
of the message") followed, optionally, by a body. The header is a
sequence of lines of characters with special syntax as defined in
this standard. The body is simply a sequence of characters that
follows the header and is separated from the header by an empty line
(i.e., a line with nothing preceding the CRLF).


satimis 11-22-2006 07:47 PM

Hi Quigi,

Tks for your advice.

Quote:

To see yourself what your mailer is encountering, you can talk to them just like you talk to your own SMTP server:
Code:

telnet a.mx.mail.yahoo.com 25

Performed 2 tests as follows;

1)
$ telnet a.mx.mail.yahoo.com 25
Code:

Trying 209.191.118.103...
quit

$ whois 209.191.118.103
Code:

OrgName:    Yahoo!
OrgID:      YAOO
Address:    701 First Ave
City:      Sunnyvale
StateProv:  CA
PostalCode: 94089
Country:    US

NetRange:  209.191.64.0 - 209.191.127.255
CIDR:      209.191.64.0/18
NetName:    A-YAHOO-US3
NetHandle:  NET-209-191-64-0-1
Parent:    NET-209-0-0-0-0
NetType:    Direct Allocation
NameServer: NS1.YAHOO.COM
NameServer: NS2.YAHOO.COM
NameServer: NS3.YAHOO.COM
NameServer: NS4.YAHOO.COM
NameServer: NS5.YAHOO.COM
Comment:
RegDate:    2005-05-20
Updated:    2005-07-21

RAbuseHandle: NETWO857-ARIN
RAbuseName:  Network Abuse
RAbusePhone:  +1-408-349-3300
RAbuseEmail:  network-abuse@cc.yahoo-inc.com

OrgAbuseHandle: NETWO857-ARIN
OrgAbuseName:  Network Abuse
OrgAbusePhone:  +1-408-349-3300
OrgAbuseEmail:  network-abuse@cc.yahoo-inc.com

OrgTechHandle: NA258-ARIN
OrgTechName:  Netblock Admin
OrgTechPhone:  +1-408-349-3300
OrgTechEmail:  netblockadmin@yahoo-inc.com

# ARIN WHOIS database, last updated 2006-11-21 19:10
# Enter ? for additional hints on searching ARIN's WHOIS database.

The IP address is Yahoo.


2)
without "a.mx."

$ telnet mail.yahoo.com 25
Code:

Trying 209.73.168.74...
quit

$ whois 209.73.168.74
Code:


OrgName:    AltaVista Company
OrgID:      ALTAVI-1
Address:    701 First Ave
City:      Sunnyvale
StateProv:  CA
PostalCode: 94089
Country:    US

NetRange:  209.73.160.0 - 209.73.191.255
CIDR:      209.73.160.0/19
NetName:    INTERNET-BLK-1-AV
NetHandle:  NET-209-73-160-0-1
Parent:    NET-209-0-0-0-0
NetType:    Direct Assignment
NameServer: NS1.YAHOO.COM
NameServer: NS2.YAHOO.COM
NameServer: NS3.YAHOO.COM
NameServer: NS4.YAHOO.COM
NameServer: NS5.YAHOO.COM
Comment:
RegDate:    2000-06-08
Updated:    2004-05-21

RTechHandle: NA258-ARIN
RTechName:  Netblock Admin
RTechPhone:  +1-408-349-3300
RTechEmail:  netblockadmin@yahoo-inc.com

OrgAbuseHandle: NETWO857-ARIN
OrgAbuseName:  Network Abuse
OrgAbusePhone:  +1-408-349-3300
OrgAbuseEmail:  network-abuse@cc.yahoo-inc.com

OrgTechHandle: NA258-ARIN
OrgTechName:  Netblock Admin
OrgTechPhone:  +1-408-349-3300
OrgTechEmail:  netblockadmin@yahoo-inc.com

# ARIN WHOIS database, last updated 2006-11-21 19:10
# Enter ? for additional hints on searching ARIN's WHOIS database.

The IP address is AltaVista Company.

What is "a.mx."?

Quote:

To fix, go to http://add.yahoo.com/fast/help/us/mail/cgi_defer and tell them your IP address is not "naughty".
Sent Yahoo following info;
Code:

1. What is your name
myname

2. What is your email address
myname@yahoo.com

3. What domain(s) are you contacting us about
satimis.com

4. Indicate the specifi IP address of the mail server experiencing the issue
myself@satimis.com

Please enter your feedback
No mail received

An acknowledge webmail was received from Yahoo.


Sent myself a webmail as follow;

$ telnet localhost 25
Code:

Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Ubuntu)
ehlo satimis.com
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250 8BITMIME
mail from: myself@satimis.com
250 Ok
rcpt to: myname@yahoo.com
250 Ok
data
354 End data with <CR><LF>.<CR><LF>

Subject: Test

This is a test, a test, a test
.
250 Ok: queued as 58B9D75404C
quit
221 Bye
Connection closed by foreign host.

But the webmail never come. I have been waiting for more than half hour. Just checked Yahoo website before answering this thread.

Others noted with Tks


B.R.
satimis

satimis 11-22-2006 07:50 PM

Quote:

Originally Posted by bathory
Well you can use whatever domain you want (existing or not existing) as yourdomain.com (you can also leave it as is or use localhost) and a valid email address to get the email (replace recipient@otherdomain.com).
But keep in mind that most mailservers do not accept mail from a host who's IP does not resolve to a domain. So you can test it locally (i.e send an email from you to yourself).

Noted with tks.

I suppose your advice sending mails is the backend. The front end software will be evolution, thunderbird, etc.? Tks.


B.R.
satimis

Quigi 11-24-2006 12:26 PM

Quote:

Originally Posted by satimis
$ telnet a.mx.mail.yahoo.com 25
Code:

Trying 209.191.118.103...
quit


It seems that you cannot even establish a connection. That's not what I get from Yahoo. Possibly you ISP is blocking port 25? (Some are nasty.) Try any other host (non Yahoo). You have to fix this first.

Quote:

2)
without "a.mx."
You changed the name. By chance, there happens to be a host "mail.yahoo.com".
Quote:

The IP address is AltaVista Company.
That's indeed odd, but don't worry about it.
Quote:

What is "a.mx."?
Arbitrary substring of the hostname :) You cannot pick it apart like that. (Apart from domain ownership/delegation considerations below yahoo.com, which shouldn't bohther you.)
But you may wonder how I got the name. Here's how:
1) You want to send mail to, say, "satimis@yahoo.com"
2) The mail domain is the part after the '@', i.e., "yahoo.com".
3) Find which hosts handle mail for that domain:
Code:

host -t mx yahoo.com
4) Pick one of the results. Not sure, but I think lower score is "better", i.e., what the owner of the MX records prefers you to use. Out of the 8 answers that I got for "yahoo.com", I picked "a.mx.yahoo.com"
5) To send mail, carry an SMTP dialog (port 25) with that host.


Quote:

Sent Yahoo following info;
Code:

1. What is your name
myname

2. What is your email address
myname@yahoo.com

3. What domain(s) are you contacting us about
satimis.com

4. Indicate the specifi IP address of the mail server experiencing the issue
myself@satimis.com


An IP address is four bytes, usually written as dotted (decimal) quad, e.g., 66.45.232.66.

Quote:

Sent myself a webmail as follow;
$ telnet localhost 25
If you cannot connect to Yahoo's, it's unlikely

satimis 11-24-2006 07:27 PM

Hi Quigi,

Quote:

It seems that you cannot even establish a connection. That's not what I get from Yahoo. Possibly you ISP is blocking port 25? (Some are nasty.) Try any other host (non Yahoo). You have to fix this first.
Now I have "satimis.homelinux.com", a free domain with dynamic IP, registered with dyndns.org.

I suppose my email address there is "satimis@satimis.homelinux.com". If I'm wrong please correct me.

Performed another test as follow:

$ telnet localhost 25
Code:

Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Ubuntu)
ehlo satimis.homelinux.com
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250 8BITMIME
mail from: satimis@satimis.homelinux.com
250 Ok
rcpt to: satimis@writeme.com
250 Ok

data
354 End data with <CR><LF>.<CR><LF>

Subject: Test

This is a test, test
.
250 Ok: queued as D203375405C
quit
221 Bye
Connection closed by foreign host.

The email never arrived.

$ host -t mx writeme.com
Code:

writeme.com mail is handled by 10 writeme-com.mr.outblaze.com.
writeme.com mail is handled by 20 writeme-com-bk.mr.outblaze.com.

$ telnet writeme-com-bk.mr.outblaze.com 25
Code:

Trying 64.71.166.195...
it only hanging here.

How to check whether port 25 is blocked by ISP? If YES how to by-pass this blockage? Tks.

Quote:

Sent Yahoo following info;

1. What is your name
myname

2. What is your email address
myname@yahoo.com

3. What domain(s) are you contacting us about
satimis.com

4. Indicate the specifi IP address of the mail server experiencing the issue
myself@satimis.com
I suppose I have to change them as;
Code:

1. What is your name
satimis

2. What is your email address
satimis@yahoo.com

3. What domain(s) are you contacting us about
satimis.homelinux.com

4. Indicate the specifi IP address of the mail server experiencing the issue
satimis@satimis.homelinux.com

I haven't sent them yet. I have to sort out "port 25" problem first.

Tks.


B.R.
satimis


All times are GMT -5. The time now is 06:29 PM.