Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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  daemon@imac.dev
                                         paperclip@gmail.com

189722E9A92F     3201 Wed Oct 13 19:35:57  MAILER-DAEMON
                       (connect to imac.lan[192.168.1.65]: Connection refused)
                                         daemon@imac.lan

1A4882E9A930     2750 Wed Oct 13 19:35:57  MAILER-DAEMON
                       (connect to imac.lan[192.168.1.65]: Connection refused)
                                         daemon@imac.lan

1F62E2E9A931     3197 Wed Oct 13 19:35:57  MAILER-DAEMON
                       (connect to imac.lan[192.168.1.65]: Connection refused)
                                         daemon@imac.lan

20B5B2E9A932     3199 Wed Oct 13 19:35:57  MAILER-DAEMON
                       (connect to imac.lan[192.168.1.65]: Connection refused)
                                         daemon@imac.lan

241E12E9A933     3309 Wed Oct 13 19:35:57  MAILER-DAEMON
                       (connect to imac.lan[192.168.1.65]: Connection refused)
                                         daemon@imac.lan

242562E9A934     2782 Wed Oct 13 19:35:57  MAILER-DAEMON
(delivery temporarily suspended: connect to imac.lan[192.168.1.65]: Connection refused)
                                         daemon@imac.lan

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)
                                         nobody@imac.local

295D42E9A936     3309 Wed Oct 13 19:35:57  MAILER-DAEMON
(delivery temporarily suspended: connect to imac.lan[192.168.1.65]: Connection refused)
                                         daemon@imac.lan

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.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

First, here's how to configure postfix to listen on localhost, as you requested:

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

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

  3. Ensure that postfix is running and reflects your configuration changes:

    $ launchctl stop org.postfix.master; launchctl start org.postfix.master

  4. 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
share|improve this answer
    
Thank 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? –  paperclip Oct 16 '10 at 15:34
    
What 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? –  Eric Dennis Oct 17 '10 at 3:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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