Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Run postfix and other Unix services via Automator Apps
Tiger only hintOn my PowerBook, I, like many others, have the postfix mail server running. In 10.3, there was a way of getting this mail server to start automatically upon login, but that doesn't seem to work anymore in 10.4, creating the annoying problem of having to open the Terminal and start it every time. This can be especially annoying when you think it's running and try to send an email and get an error as the server isn't running (I don't even bother with other SMTP services as it is too much hassle).

I decided I wanted to use the power of Automator to be able to run the server without having to open Terminal, etc. (it's a lazy man's way of doing things, I know, but this will allow for extensibility). Not knowing much about Automator, I searched this site and found this hint. I modified it slightly to be able to run the postcast mail server.

Basically, what you to do is as follows...

Open Automator and select the Finder option in the Library column, and drag the "Get Selected Finder Items" Action into the workflow area. Then choose the Automator option in Library, and select the the "Run Applescript" Action and drag it into the workflow area. Put this AppleScript into the text area:

on run {input, parameters}
  tell application "Terminal"
    if (the (count of the window) = 0) or 
      (the busy of window 1 = true) then
      tell application "System Events"
        keystroke "n" using command down
      end tell
    end if
    do script "sudo postfix start" in window 1
    do script "my_password" in window 1
  end tell
  return input
end run
Replacing the my_password bit with your actual administrator's password, as this will allow it to actually work!

Obviously, you can also use this script to start anything that needs starting in one go. For me that was the xampp system for Apache and PHP. To do so, simply put in more do script "unix command" in window 1 lines to run more things in the Terminal.

[robg adds: I believe this hint (note the fix in the comments) explains the standard way of enabling the server in 10.4 (though it also implies that it should already be set up to run 'on demand,' which should mean this hint is unnecessary). Three other hints cover related postfix/SMTP topics.]
  • Currently 1.00 / 5
  You rated: 1 / 5 (2 votes cast)

10.4: Run postfix and other Unix services via Automator | 4 comments | Create New Account
Click here to return to the '10.4: Run postfix and other Unix services via Automator' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Run postfix and other Unix services via Automator
Authored by: ngb on Sep 28, '05 09:18:43AM

In response to Rob's comment regarding using launchd as the preferred way to start postfix, there is a good article on launchd at

[ Reply to This | # ]
10.4: Run postfix and other Unix services via Automator
Authored by: TiBo on Sep 28, '05 10:27:47AM

This old hint
did the trick for me. Very straight forward.

[ Reply to This | # ]
10.4: Run postfix and other Unix services via Automator
Authored by: rspress on Sep 28, '05 07:07:13PM

I am sure some Applescript god could tell me a way to pass the file name that "Get selected finder item" to the Applescript so the command line can run it.

Say I have a file called Game.rar

and I want the applescript to do this "unrar e"

how do I do it so the terminal runs "unrar e /pathname/Game.rar

The script in the article does most of this but I don't think it passes the name to the unix command. I am sure readers of MacOSXhints would know this!

[ Reply to This | # ]
postfix null client
Authored by: gshenaut on Sep 29, '05 08:38:03PM

I don't need a full-service postfix mail server, but I do want to be able to send mail out from scripts, etc. To do this, I edited two files in /etc/postfix: and In, I set "myorigin" to the host I wanted outgoing mail to be from; "relayhost" to the actual mail server that will send the mail (it must be willing to relay mail from you, obviously). "local_transport" is set to the string "error:local delievery is disabled". In, I commented out the entries for "SMTP server" and "local delivery agent". Note that there are no doublequotes in the actual files, I just used them here for clarity.

Note that I only use this inside our local network, this is why I don't have to fiddle with authentication and why the relayhost will relay my mail. If you want a more general null client that will work in any location with authenticating SMTP server, it will be more complicated. Also, if you want to receive mail with postfix, it will be more complicated.

Anyway, if I am remembering this correctly, once you edit those files, you can send mail with mail(1). Actually, it may work for most people out of the box, maybe my set-up is strange. I wouldn't know.

Greg Shenaut

[ Reply to This | # ]