I have PostFix up and running on a CentOS box and would like to send mail from a Windows server on the same network out through the PostFix server.

When I try to telnet from the Windows server into port 25 on the PostFix server currently the connection fails.

Where do I set this up within PostFix/CentOS?

Thanks in advance!

3 Answers 3


You will need to configure relay. However when postfix is running you should be able to still connect to port 25. Might there be a firewall blocking this connection?

When you open main.cf, you can need to add this directive:



mynetworks =
mynetworks = !,
mynetworks = [::1]/128 [2001:240:587::]/64

do not put or you will become an open relay.

  • That solves the relay problem...will open another question to address the problem of being unable to telnet in via port 25. Thanks. Mar 20, 2012 at 20:05
  • Lucas, I don't believe this actually does what I need it to do. From the way I read it, configuring the relay host tells the postfix server where to send mail after receiving it. However, I want mail to go out directly from this postfix server, I just want to configure it to allow other machines to relay mail to it...does that make sense? Mar 21, 2012 at 12:06
  • I made a mistake, it should have been mynetworks, not relayhost, like in the example. Relayhost is indeed to tell other machines to use this server as relay. You put all the network addresses of the allowed machines after this directive to allow them to use the relay. Mar 21, 2012 at 12:15
  • @WindowsNinja if you can't telnet to port 25 from other machine, remember to verify inet_interfaces in main.cf, it's probably set to localhost thus not listening on other interfaces.
    – DiegoG
    Dec 22, 2018 at 9:03

My Postfix server has something of the sort in its IPtables to enable connections.

ACCEPT     tcp  --             state NEW tcp dpt:25

Your server might be restricted even further, depending on what you are trying to do. But if telneting to it on port 25 fails do not expect the machine to function as an SMTP server (unless of course you change the ports - which is not what you said). Note that it is possible, many time preferable to accept connections on other ports.


@LucasKauffman is correct, mynetworks is the way to go --- but be sure that smtpd_recipient_restrictions has permit_mynetworks, something like this:

smtpd_recipient_restrictions = permit_mynetworks, ...

This is the default, but if you have -o smtpd_recipient_restrictions=something on an smtpd line in master.cf then it will override main.cf setting.

  • Ok but how to set postfix so i can send mail through a local user (local to postfix) by setting smtp server, username and password at 'remote' client side? Jun 21, 2021 at 12:10
  • @john_who_is_doe, I think you'll need to open a new question, I'm not sure I understood what you mean.
    – KJ7LNW
    Jun 29, 2021 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.