• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1844
  • Last Modified:

how to setup qmail with smtp using port 1025 or other port other than 25?

Dear All,

I have a qmail server now, it is running smtp with default port, 25.
Now, I want to change it to another port other than 25, eg, 1025, or 3388,
how can I do that?

Which files I have to modify?

Thank you.

4 Solutions
Look into /var/qmail/control/conf-common file (at leat on my distribution) and look for the following lines:

# Host and port to listen on
# We listen on the IPv4 local ip by default

Change TCPSERVER_PORT=1025 for example and restart service :)
I can't remember the files myself and don't have access to my home system at the moment.  However, you may want to check the website:


The entire site is dedicated to installation and configuration of Qmail.  It's been very handy for my own issues.  Good luck!
deurk: You are talking about a gentoo specific configuration file. Gentoo's configuration sucks, so better do it the way djb advizes.

Stanley: If you followed djb's instructions, your smtp server is probably being run from /service. So just "cd /service/qmail-smtpd". Then edit the "run" file in that directory. It should have a reference to "tcpserver". Find the two parameters that give the ip address and port to listen on (these should be obvious, because one of them should be 25) and change the port from 25 to 1025. If you are running gentoo, then follow deurk's advice.

Restarting the service in the end: svc -t /service/qmail-smtpd
stanleyhuenAuthor Commented:
thx chutz,
it seems your comment is very near the answer.
can i listen to both 25 and 1025?

Thank you.

All you need are two instances of tcpserver and you're done. You could simply copy the directory where the current configuration is to another one, edit the run file and link the new directory in /service. Ah, also be careful to edit the logger path, in case your are logging to an absolute location. Something along the lines of:

cd /service
dir=$(dirname $(readlink qmail-smtpd))
cp -av $dir/qmail-smtpd $dir/qmail-smtpd-1025
$EDITOR $dir/qmail-smtpd-1025/run
$EDITOR $dir/qmail-smtpd-1025/log/run
rm -f $dir/qmail-smtpd-1025/log/main/*
ln -s $dir/qmail-smtpd-1025

Or just create the new directory yourself, copy over the "run" file and edit it. Do the same for the "log" directory.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now