LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-16-2024, 05:38 AM   #1
cola
Senior Member
 
Registered: Sep 2007
Posts: 1,045

Rep: Reputation: 65
How can I check if port 25 open for outgoing or to send email only?


How can I check if port 25 open for outgoing or to send email only?

I mean, I want to send email through 25 port. I do not want to receive email through 25 port.

If I do telnet smtp.gmail.com 25, it said connected and it prompts to enter input. Does that mean the port 25 open for sending email?

But from online port checker tool, for my public ip address, I see, port 25 is closed.
 
Old 04-16-2024, 05:49 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by cola View Post
If I do telnet smtp.gmail.com 25, it said connected and it prompts to enter input. Does that mean the port 25 open for sending email?
Yes

Quote:
Originally Posted by cola View Post
But from online port checker tool, for my public ip address, I see, port 25 is closed.
Unless you've specifically opened a port on your router and are forwarding it to a listener then it will appear closed.
 
Old 04-16-2024, 06:27 AM   #3
cola
Senior Member
 
Registered: Sep 2007
Posts: 1,045

Original Poster
Rep: Reputation: 65
So I can say that the port 25 is open for outgoing but closed for incoming, right?
 
Old 04-16-2024, 06:48 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
I guess it is not precise enough.
port 25 is used to receive a connection (from server side), or with other words to connect to a mail server (client side).
Client can communicate with the given mail server ( smtp.gmail.com ) on the given port of that mail server and can use it to send mails. The port on the client side is not important, but most probably it is not 25.
You can only send mails using this smtp port with the client.

https://www.duocircle.com/content/sm...ce/smtp-server
https://serverfault.com/questions/74...g-emails-works

Last edited by pan64; 04-16-2024 at 06:49 AM.
 
Old 04-16-2024, 08:44 AM   #5
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,604

Rep: Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547Reputation: 2547

Running "ss -pltn" (as root/sudo) will tell you which processes are listening on which TCP port numbers.

If something is listening on port 25, that port is open - unless there are firewall/router rules changing that.

If nothing is listening on port 25 (and there's nothing forwarding port 25 to another port) then that port is closed.


Last edited by boughtonp; 04-16-2024 at 08:45 AM.
 
Old 04-16-2024, 09:40 AM   #6
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,728

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
My understanding is that port 25 (smtp) is the default port for receiving email messages. In order for that to work, a Mail Transport Agent (MTA) (sendmail, qmail, etc.) must be listening on the port and accepting connections.

The telnet connection prompting for input indicates that the port is open for receiving email.

Sending email does not use port 25 on the sending server.. The MTA must be able to connect to port 25 on other, foreign servers, but it doesn’t use the local port 25 to do that…mainly because that port is not available for that. It’s busy listening for and receiving email.

These days, of course, the sending server must comply with several conventions and rules in order for receiving servers to accept the email it sends, but that’s a whole other subject.

Is this a home computer? A server on the internet? What?

Last edited by scasey; 04-16-2024 at 09:47 AM.
 
Old 04-20-2024, 06:22 PM   #7
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
understand that while a TCP connection exists there are two ports involved, one on each end. when the connection is being made, one end is sending a request to establish a connection to the other end. the end that is sending is known as the source. the other end that is being targeted is known as the destination which needs to be listening for incoming connection requests for the port number on that end. the request that arrives will have a source address and source port. once the connection is established, four numbers together (known as a tuple) uniquely identify the connection in a particular direction. flip the source and destination pairs to identify the same connection in the reverse direction. no other connection will have all of these numbers at the same time (or for a couple minute afterwards). network activity (routing, filtering, accepting, etc.) will generally be based on one or two particular numbers (possibly from lookup results of particular configured name). it is important to say which number when stating number. in most cases this is obvious as in "connecting to port 25" (assumed to mean the destination port is 25 and the source port could be some random number like 18336). each end has an address as well, where you are "connected to" (such as the target mail server) and where you are "connected from" (such as the address your laptop got this hour). be sure to avoid confusion or a mix-up of possibilities by explaining what each number is to us (like "dest port 25") and being as complete as possible.

> My understanding is that port 25 (smtp) is the default port for receiving email messages.

to be more precise it is for exchanging email (when considering both sides generally need to run a mail server). for a single piece of email we look at the destination address, but both sides will usually be listening for port 25 when both sides are email servers.

> Sending email does not use port 25 on the sending server..

that can be confusing. both sides do have port 25 but a connect to send email uses port 25 for its destination and some random port for its source (such as 18336). the "sending server" does use port 25 but it uses is as a destination port so that it goes to the proper socket on the other server it connected to.

> Is this a home computer? A server on the internet? What?

indeed, these are questions we need answered by the original poster (OP).

i'm considering blocking port 25 from coming in because it seems all the spam comes in that way. will that affect my "send only" email?
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Server with : Postfix,dovecot. (Can send email, but can't receive email from internet mail) cparapat Linux - Server 1 08-16-2010 12:57 AM
Perl email::send.. how to send the email? hawk__0 Programming 6 12-24-2009 01:53 PM
Which qmail log file details outgoing mail? (have huge outgoing mail volume) hilljockey Linux - Server 2 12-08-2008 04:26 PM
Send outgoing mail to a specific IP address and port starkhorn Linux - Software 1 01-31-2008 05:20 PM
Setup new Linux install to send outgoing email only BigFunkyChief Linux - Server 1 12-05-2007 03:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration