19

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!

24

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=A.B.C.D 

example:

mynetworks = 127.0.0.0/8 168.100.189.0/28
mynetworks = !192.168.0.1, 192.168.0.0/28
mynetworks = 127.0.0.0/8 168.100.189.0/28 [::1]/128 [2001:240:587::]/64

do not put 0.0.0.0 or you will become an open relay.

4
  • 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 '12 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 '12 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 '12 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 '18 at 9:03
0

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

ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           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.

0

@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.

2
  • 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 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 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.