Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I try the command in terminal, an email is sent. I have checked there is no local SMTP is running, so what is the mechanism used by Apple behind the scene?

echo "Hello" | mail -s "Test"
share|improve this question
up vote 4 down vote accepted

mail on OS X does actually seem to spawn Postfix long enough to deal with the mail, then tear it down a short time later.

To see this in action, try telnet localhost 25 before the mail command, then immediately after, then wait 5 minutes and try it again.

I am not sure this is actually a proper answer to the question because it doesn't explain how Postfix is spawned and torn down, but hopefully it helps answer the question.

share|improve this answer

SMTP daemons or servers are there to receive mail, not send it. In your example, mail is purely an email client, and it connects to whatever server is defined by the appropriate DNS MX record of, and has no requirement for a local server to be running in order to do so.

However, depending on your mail setup, you may require to log into an outgoing mailserver to authenticate, or if nothing else just to provide sender and return-to addresses etc. Now, you can do all this at the command line by passing the appropriate parameters on the terminal, but as long as you have set up your Mail app, this config is already stored, and by simply temporarily firing up the mail subsystem the terminal commands can grab that info and now have one or more mail smtp servers they can choose to send outgoing messages. It will then terminate the processes when complete.

You can test this all out at the command line and send the mail without having to use a mail client. I'm not at a Mac, so these commands may need editing by someone who is, but you can do this:

set type=mx

telnet MXServer 25 (where MXServer is one of the results returned above and 25 is the port number for SMTP servers)

Read This for more info on emailing via telnet - it's a great debugging tool

share|improve this answer
While your answer received the highest of votes, but it is wrong. Mac will spawn a Postfix to receive the email and shutdown automatically as @zigg suggested above. Thanks for your effort anyway. – Yoga Aug 4 '13 at 4:43
It's not that it's incorrect as such, all the details are correct, but it doesn't necessarily answer your question in its current form. Edited to do so. – stuffe Aug 4 '13 at 17:17

I think mail always uses local sendmail to send mails. At OSX sendmail is postfix. And it is definitely used.

You can check the mail headers Received: by [Your-Mac] (Postfix, from userid ....

Nevertheless it is not a good idea to use mail (or better postfix) like this. Best practice would be to use a Smart Host for your local Postfix to avoid often used firewall restrictions.

You can find a solution at SMTP Smart Host Setup for Postfix in Snow Leopard which works for me (also on Lion, Mountain Lion).

share|improve this answer
From the header, I found...Received: by with SMTP id xxx;...X-Received: by with SMTP id yyy;...but my internal IP is 192.168.x.x – Yoga Aug 3 '13 at 4:51

Your Answer


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.