The Simple Mail Transfer Protocol(SMTP) server in Ubuntu is available via the package "Postfix", which is the most widely used SMTP server in UNIX-like systems including AIX, BSD, HP-UX, Linux, MacOS X, Solaris, and more environments.
SMTP as a service runs on Port 25.
fossphosis@fossphosis:~$ cat /etc/services | grep smtp
smtp 25/tcp mail
ssmtp 465/tcp smtps # SMTP over SSL
To get Postfix running on Ubuntu, all one needs to do is apt-get the package.
Once, Postfix is installed, in case of configurations apart from the default ones, reconfigure the settings by running the dpkg-reconfigure, to set the parameters matching the network requirements.
fossphosis@fossphosis:~$ sudo dpkg-reconfigure postfix
I wanted my SMTP instance available on the local network for all the machines on the 192.168.1.X subnet. To accomplish this the only change, or the appendage to the existing default configuration is to add the subnet in the entry, as shown below:
In case of applications, like the one I was faced with, where i wanted the SMTP to run on an alternate port other than Port 25 parallely, all you need to do is add the port entry in the following postfix configuration file.
Edit /etc/postfix/master.cf,
I wanted SMTP to run on port 2525, so added the following entry just, as shown below:
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd
2525 inet n - - - - smtpd
Once editing is done, restart the Postfix server
fossphosis@fossphosis:~$ sudo service postfix restart
[sudo] password for fossphosis:
* Stopping Postfix Mail Transport Agent postfix [ OK ]
* Starting Postfix Mail Transport Agent postfix [ OK ]
To verify if SMTP is running on both the ports,perform a basic telnet to the ports.
Testing on port 25
fossphosis@fossphosis:~$ telnet localhost 25
Trying ::1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 Comp ESMTP Postfix (Ubuntu)
Testing on port 2525
fossphosis@fossphosis:~$ telnet localhost 2525
Trying ::1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 Comp ESMTP Postfix (Ubuntu)
And, that's it!
SMTP as a service runs on Port 25.
fossphosis@fossphosis:~$ cat /etc/services | grep smtp
smtp 25/tcp mail
ssmtp 465/tcp smtps # SMTP over SSL
To get Postfix running on Ubuntu, all one needs to do is apt-get the package.
fossphosis@fossphosis:~$ sudo apt-get install postfix
Once, Postfix is installed, in case of configurations apart from the default ones, reconfigure the settings by running the dpkg-reconfigure, to set the parameters matching the network requirements.
fossphosis@fossphosis:~$ sudo dpkg-reconfigure postfix
I wanted my SMTP instance available on the local network for all the machines on the 192.168.1.X subnet. To accomplish this the only change, or the appendage to the existing default configuration is to add the subnet in the entry, as shown below:
Adding 192.168.1.0/24 subnet for reachability of the SMTP server on my network |
Edit /etc/postfix/master.cf,
I wanted SMTP to run on port 2525, so added the following entry just, as shown below:
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd
2525 inet n - - - - smtpd
Once editing is done, restart the Postfix server
fossphosis@fossphosis:~$ sudo service postfix restart
[sudo] password for fossphosis:
* Stopping Postfix Mail Transport Agent postfix [ OK ]
* Starting Postfix Mail Transport Agent postfix [ OK ]
To verify if SMTP is running on both the ports,perform a basic telnet to the ports.
Testing on port 25
fossphosis@fossphosis:~$ telnet localhost 25
Trying ::1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 Comp ESMTP Postfix (Ubuntu)
Testing on port 2525
fossphosis@fossphosis:~$ telnet localhost 2525
Trying ::1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 Comp ESMTP Postfix (Ubuntu)
And, that's it!
No comments:
Post a Comment