Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-19-2004, 11:41 AM   #1
LQ Newbie
Registered: Oct 2004
Posts: 8

Rep: Reputation: 0
Sending Mail via cron every hour without user input.

I am running linux (mandrake) and need to setup a script to send a test email every hour using cron. Cron is not my problem, the mail command is. I tried this:

mail "" -s "test email"

at this point I want "`date`" to be the body of the email and then send. But I can't get it to without manually doing `date` and the "Enter" and the "Control-D" and then go through the "Cc" of which I don't even want.

I am sure this is fairly simple but I am new to Linux and not up to speed on all the command switches, etc.

Thanks for any help.
Old 10-25-2004, 02:55 PM   #2
Senior Member
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
Try to pipe input to the mail command. Try
echo `date` | mail "" -s "Test mail"
if that doesn't work try adding a - at the end of the line above.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron mail sending using outside SMTP mail server Utah Linux - Software 6 08-24-2005 08:44 PM
Sending output to mail account through cron. gian2oo1 Slackware 2 01-18-2005 01:54 PM
Cron sending mail to root bspicer Linux - General 2 05-01-2002 01:52 PM
Who is Cron and why is he sending me all this mail?... lhoff Linux - Newbie 3 03-06-2002 05:40 PM
Sending Greeting mail to new user ranjit001 Linux - Networking 1 01-03-2001 12:58 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:09 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration