|May 12, 2008, 09:16 PM||#1|
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" email@example.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?
|Nov 7, 2009, 06:10 AM||#2|
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 "firstname.lastname@example.org", 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 "MAILTOemail@example.com" 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 06:30 AM. Reason: Improved information in post based on further investigations.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Default Mail App - Yahoo! no longer sending mail||a.jfred||iPhone and iPod touch Apps||2||Dec 17, 2013 10:54 AM|
|Mail not sending email||tails1||OS X 10.8 Mountain Lion||2||Apr 16, 2013 05:12 PM|
|Resolved: e Mail Not Sending||chattahoochee||MacBook||0||Feb 8, 2013 04:42 PM|
|Sending Mail on a specified time?||wayneholbrook||Windows, Linux & Others on the Mac||0||Jan 27, 2013 02:31 PM|
|Mail app sending mail from diff accounts. Please help.||SammyDFG||Mac Applications and Mac App Store||9||Jan 13, 2013 08:51 PM|
All times are GMT -5. The time now is 08:45 PM.