LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 08-21-2003, 08:50 AM   #1
Minuteman
LQ Newbie
 
Registered: Mar 2003
Location: Switzerland
Distribution: Redhat, Slackware
Posts: 20

Rep: Reputation: 0
Sending an automatic mail using bash + mail


Hello, I want to make a shell (bash) script that automatically sends me a message without an user interaction.

I tried: mail root -s "Hello you"

but then the program absolutely wants that I hit 2 times on the enter key... is there a way to tell bash to make a "return to the line" or a better way to do this?
 
Old 08-21-2003, 09:05 AM   #2
m0rl0ck
Member
 
Registered: Nov 2002
Distribution: A totally 133t distro :)
Posts: 358

Rep: Reputation: 31
echo hello|mail -s test "Hi dere"

and hello will appear in the message body, you can also do this with cat to read a file or just about any prog that outputs text that youd like mailed


EDIT: should have been echo hello|mail -s "Hi dere" user@host

I can cut and paste much faster than I can think

Last edited by m0rl0ck; 08-22-2003 at 02:33 AM.
 
Old 08-21-2003, 09:14 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
AFAIK it's "cat <sometext>|mail -s "<subject>" <mail@address>"
Btw, you can also send MIME attachments using "mpack" instead of "mail".
 
Old 08-21-2003, 09:15 AM   #4
Minuteman
LQ Newbie
 
Registered: Mar 2003
Location: Switzerland
Distribution: Redhat, Slackware
Posts: 20

Original Poster
Rep: Reputation: 0
It works great so, thank you all for your quick answers :-)
 
Old 08-21-2003, 12:49 PM   #5
lfur
Member
 
Registered: Jul 2003
Location: Slovenia
Distribution: Slackware & FreeBSD
Posts: 209

Rep: Reputation: 30
A bit late but ...
mail some@address.here < textfile
 
  


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
Postfix mail transfer agent not sending mail locally or to other servers sketelsen Linux - Software 3 02-09-2006 11:16 AM
Cron mail sending using outside SMTP mail server Utah Linux - Software 6 08-24-2005 07:44 PM
Sending mail through mail server. TheRealDeal Linux - Networking 17 09-11-2004 11:31 PM
Sending mail through mail server. TheRealDeal Linux - Networking 0 09-06-2004 11:43 PM
Mail Server not sending mail baye Linux - Software 1 05-28-2004 08:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:49 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