Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > OS X

Reply
 
Thread Tools Search this Thread Display Modes
Old May 12, 2008, 08:16 PM   #1
TurboLag
macrumors member
 
Join Date: Feb 2004
Sending mail through terminal

I have a few cron jobs which periodically check my RAID status and disk usage. I would like to have the outcome emailed to myself. The proper syntax for sending mail through terminal is mail -s "subject" myname@gmail.com, however nothing is sent. I know my cron jobs work as I had the outputs redirected to a file.

How does the mail application know what mail server to send the email through? If it used the recipients email server, what happens if it requires authentication? How can I configure the /usr/bin/mail command to use a specific smpt server?
TurboLag is offline   0 Reply With Quote
Old Nov 7, 2009, 05:10 AM   #2
SpaceMonkey2369
macrumors newbie
 
Join Date: Nov 2009
This worked for me:

I know that this is an old thread, but I fixed this problem today and hope that my solution might aid somebody else who has the same difficulties.

I could not receive mail from Cron, nor through the command line via 'mail' or 'sendmail' commands. Things that I had to do were:

1) Edit /etc/postfix/main.cf and find the line which starts with "myorigin=..." (it should be commented out by default). Put the domain name part of your own email address here, e.g. if your email address is "me@mydomain.com.nz", then change the line to "myorigin=mydomain.com.nz".

2) Find the line in the main.cf file which starts as "relayhost=..." (once again, should be commented out by default). Change this to fully qualified name of your mail server in square braces, e.g. "relayhost=[mail.myisp.com.nz]". Don't forget the square braces or you will cause a host lookup error.

3) When editing your crontab, make sure to include your required destination email address in the 'MAILTO' command, e.g. put the line "MAILTO=me@mydomain.com.nz" at the start of your crontab file.

That's it! Worked for me... Now getting mail from Cron and can send emails on the command line.
__________________
He who makes a beast of himself gets rid of the pain of being a man. - Samuel Johnson

Last edited by SpaceMonkey2369; Nov 7, 2009 at 05:30 AM. Reason: Improved information in post based on further investigations.
SpaceMonkey2369 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > OS X

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
anyone else unable to send emails through ME using both mail & iphone 3G? jimmyonassis iCloud and Apple Services 0 Jul 12, 2008 06:27 AM
Sending Mail through OSX Mail.app drumpat01 iCloud and Apple Services 0 Jul 11, 2008 02:33 PM
Sending mail from Mac through Gmail IMAP Tom D Mac Applications and Mac App Store 1 Apr 4, 2008 08:55 AM
Sending email through Mail won't work v-ault Mac Applications and Mac App Store 1 Aug 8, 2007 04:42 PM
sending mail through ssh tunnel with mail.app dpope Mac Applications and Mac App Store 6 Dec 24, 2006 05:33 AM


All times are GMT -5. The time now is 04:39 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC