I'm using mac OS (10.13.4). I somehow have a mail server running and able to send email from katie@katie.local by using the command

echo "mbody" | mail -s "msub" "to_email@gmail.com"

Although email is received in the Spam folder due to the non-reg DNS.

postfix isn't running in my system:

katie@nyxae $ sudo postfix status
postfix: Postfix is running with backwards-compatible default settings
postfix: See http://www.postfix.org/COMPATIBILITY_README.html for details
postfix: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: use_sacl_cache=yes
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: imap_submit_cred_file=
/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: mydomain_fallback=localhost
postfix/postfix-script: the Postfix mail system is not running

I ran lsof -i 4 -a to see if any known email service is running on port 25. But found no related services.

So my question is what service is enabling this? And how is it possible?

  • Lots of mail services besides postfix. And since OS X is a Unix, there is probably a sendmail binary somewhere on teh system.... – ivanivan Apr 22 '18 at 1:44

Historically, the Unix mail command does not use network services at all. It just runs /usr/sbin/sendmail with the necessary options, and pipes the outgoing email to it. This is literally where sendmail got its name from. For incoming mail, it would simply read the user's local system inbox located at /var/mail/<username>.

Because of this convention, even when your unix-like OS is using some other mail transport software, like Postfix in the case of macOS, that software needs to provide /usr/sbin/sendmail binary that understands a well-known set of options, for the purpose of implementing this old simple interface.

As a result, this method of invocation starts just the right part of Postfix for an one-shot mail transmission, even if the Postfix software is otherwise unconfigured and on factory defaults: if the recipient is a local user, or the recipient server can be determined from DNS MX and/or A records and is reachable, the mail will be sent on its way and the /usr/sbin/sendmail process will exit with result code 0, indicating to the mail command that the operation was successful.

But if the recipient server cannot be immediately reached, all bets are off: in this case the /usr/sbin/sendmail component would store the message in the local system's outgoing mail queue (historically /var/spool/mqueue, with Postfix it's probably /var/spool/postfix/deferred)... where it will rest, forgotten, until the end of time if the rest of the mail transfer software has not been activated, as the process that is supposed to periodically check the mail queue will not be running.

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.