LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-20-2004, 01:12 PM   #1
cpope67
LQ Newbie
 
Registered: Oct 2004
Posts: 8

Rep: Reputation: 0
Linux Mail Script


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 "name@domain.com" -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-20-2004, 07:56 PM   #2
ghoughto
LQ Newbie
 
Registered: Oct 2004
Posts: 8

Rep: Reputation: 0
Here is the solution:

date | mail username@whereever.com -s "This works"

Hope this helps.
 
Old 10-21-2004, 10:08 AM   #3
cpope67
LQ Newbie
 
Registered: Oct 2004
Posts: 8

Original Poster
Rep: Reputation: 0
Thumbs up Waaaahoooo!!!!

Thanks ghoughto! Short, sweet, simple......and it works. I'll add it to cron. I didn't realize you could pipe something into the mail command.

Thanks,
Chris
 
  


Reply



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
Shel script mail send ("/" in mail address) problem anaid Linux - Networking 3 08-23-2005 07:41 AM
CGI Script runs to send mail, but mail is never sent robertwo Linux - Newbie 2 06-10-2004 09:57 AM
Linux Mail Header script/system luckyduckydave Linux - General 0 05-20-2004 08:41 PM
mail script doesn't run wedgeworth Linux - Software 0 10-15-2003 01:02 PM
E-Mail notification to users via SMS (gateway script ok, but notification script?!?) Riku2015 Linux - Networking 10 03-08-2002 10:16 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:33 PM.

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