Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm trying to figure out some basic Terminal commands, so I thought I'd try out 'mail.'

I opened a Terminal window and entered the following:
mail (my email address)
(The Terminal then said "Subject:" without quotes) so I entered "test" without quotes.

"This is a test message" without quotes

I then ended the message by typing . and enter, but nothing has send to my inbox.

share|improve this question
    
Let's make this mail only and ask SMS as another question that stands alone. –  bmike Aug 23 '11 at 22:18
    
The SMS is trivial to implement using a http API like twilio - they charge a penny per message they send or receive for you. curl will work from the terminal, but remember programming / API is generally off topic here unless you are using AppleScript or Automator. –  bmike Aug 23 '11 at 22:32

3 Answers 3

You did not specify which inbox you checked, but if you use mail <your mac userid>, you can then read that mail by running the mail command without any arguments. I am not sure how useful this might be, but it does work.

man mail from a shell prompt will give you more background info into the mail command.

If you are looking to send email to an external (SMTP) mail server from a shell prompt (like the one in the Terminal window), you will need to use a message transfer agent or MTA. This is something far more useful, although it requires much more setup overhead.

Alternatively, you might be able to use Applescript and/or Automator to automate sending messages through Mail.app through a previously configured email account.

share|improve this answer

Add an additional blank line after the Subject line.

share|improve this answer

Actually OSX has a perfectly good Mail Transfer Agent (MTA) built in and configured. When you send a mail message from the command line using mail it will fire up Postfix long enough to send the mail.

The only caveat is that it may need to know about an outgoing mail link and uses the settings in the Mail app to discover one. So I'm assuming you haven't set Mail up to be able to send mail.

If that's the case then set up Mail and try the command again.

See this answer for some more details on what's happening and mail in general.

Quite a lot of SMTP servers are happy to accept mail from almost anywhere and believe it to be valid but yours may not be one of them.

share|improve this answer

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.