Setting up Mac localhost mail server on OS X
First, here's how to configure postfix to listen on localhost, as you requested:
Configure postfix to listen only on localhost by modifying the /etc/postfix/main.cf file. Add or edit it to have the following inet_interfaces definition:
inet_interfaces = localhost
Make sure postfix starts on bootup. Modify the /System/Library/LaunchDaemons/org.postfix.master.plist file, adding the following line before
</dict>
:<key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/>
Ensure that postfix is running and reflects your configuration changes:
$ launchctl stop org.postfix.master; launchctl start org.postfix.master
Verify that postfix is listening on TCP/25 on localhost only:
$ netstat -an | grep 'LISTEN' | grep 25
tcp4 0 0 127.0.0.1.25 *.* LISTEN
However, if you want the bounce messages that I see in your queue to be delivered to imac.lan, you'll also need to have postfix listening on 192.168.1.65 (or whatever your current IP address is) as well. One way to do that is to modify the inet_interfaces line to:
inet_interfaces = all
Related videos on Youtube
![paperclip](https://i.stack.imgur.com/TzGnt.jpg?s=256&g=1)
paperclip
Updated on September 17, 2022Comments
-
paperclip almost 2 years
I was advised that this may be a better location for my question than SO.
I've been trying to setup my Mac OS X (10.5.8) to send emails from localhost so that I can test my scripts.
I normally get success messages, saying emails have been sent but they never reach their destination.
They appear to just get stuck in the Postfix mailq:
bash-3.2# mailq -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient------- 60F062E9A958* 343 Wed Oct 13 19:36:24 [email protected] [email protected] 189722E9A92F 3201 Wed Oct 13 19:35:57 MAILER-DAEMON (connect to imac.lan[192.168.1.65]: Connection refused) [email protected] 1A4882E9A930 2750 Wed Oct 13 19:35:57 MAILER-DAEMON (connect to imac.lan[192.168.1.65]: Connection refused) [email protected] 1F62E2E9A931 3197 Wed Oct 13 19:35:57 MAILER-DAEMON (connect to imac.lan[192.168.1.65]: Connection refused) [email protected] 20B5B2E9A932 3199 Wed Oct 13 19:35:57 MAILER-DAEMON (connect to imac.lan[192.168.1.65]: Connection refused) [email protected] 241E12E9A933 3309 Wed Oct 13 19:35:57 MAILER-DAEMON (connect to imac.lan[192.168.1.65]: Connection refused) [email protected] 242562E9A934 2782 Wed Oct 13 19:35:57 MAILER-DAEMON (delivery temporarily suspended: connect to imac.lan[192.168.1.65]: Connection refused) [email protected] 2917A2E9A935 2629 Wed Oct 13 19:35:57 MAILER-DAEMON (Host or domain name not found. Name service error for name=imac.local type=MX: Host not found, try again) [email protected] 295D42E9A936 3309 Wed Oct 13 19:35:57 MAILER-DAEMON (delivery temporarily suspended: connect to imac.lan[192.168.1.65]: Connection refused) [email protected]
What can I do to get this working?
If it helps, I have imac.dev pointing to 127.0.0.1 in my /etc/hosts
Thanks, P.
-
paperclip over 13 yearsThank you for the information. I believe I had made some headway but now the problem is that any messages in my mailq just time out. Any ideas to fix this and get them to send?
-
Eric Dennis over 13 yearsWhat does /var/log/maillog say about why the messages aren't being delivered? Are the messages destined for your local machine or for an external MTA?