I'm having trouble trying to send email with the unix mail command. Currently I'm trying this:

echo "something" | mail -s "test mail" email@address.com

But when I check my email, I haven't received it.

How do I get it working? I'm using Mac OS X 10.7

  • 2
    You might get more useful output by using the -v option to mail. – Flup Apr 5 '13 at 13:44
  • 1
    All I get is: "Mail Delivery Status Report will be mailed to <tre11>", where tre11 is my Macbook username. – Eddy Apr 10 '13 at 16:52

So, it's probably at least one thing, possibly two.

  1. You need to enable the mail service. On the latest MacOSX, postfix is installed by default. You just need to run 'sudo launchctl start org.postfix.master' to start the postfix server. That'll just temporarily start it for your current session. Check to see if any mail can be sent. Look in /var/log/mail.log.
  2. If mail can't be sent out via port 25 (for example, comcast blocks outgoing port 25), you'll need to configure postfix to deliver mail through either Comcast's SMTP service or via some other SMTP server.

I found some well-documented instructions here on how to set up GMail's SMTP server and enable MacOSX's postfix service.

  • It works when I'm at home, but it doesn't work at the university which is where I want to use it. I suspect it's a blocked port or something. I've tried following the instructions in the link, but that didn't work. – Eddy Apr 10 '13 at 16:51

1) Use man mail to check if your mail program supports -v command line option (verbose mode). It should provide ore hints.

echo "something" | mail -v -s "test mail" email@address.com

2) Check log entries generated by your MTA/mail server (postfix/sendmail/exim/...)

  • It just says "Mail Delivery Status Report will be mailed to <tre11>". I can't find the log entries – Eddy Apr 10 '13 at 16:50

Make sure you've correctly configured the SMTP settings in your mailing daemon configuration file

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • Need also to set up that whoever is supposed to relay mail does so. That is usually disabled to limit spam. – vonbrand Apr 5 '13 at 15:44

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.