Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linux scripting to send a mail message

Status
Not open for further replies.

SM777

Technical User
Mar 7, 2001
208
GB
Hi,

how do I use linux scripting to send a mail message.

Want to send a message to user@someone.com with a subject of "hello" no message contents required.

Cheers.
 
Ok, first of all there's no such thing as "linux scripting".
There are many ways to do this, you can run the script on the command line and tell it to send the output to mail whomever (i.e., ./foobar |mail user@somewhere) or you can put it in the script like so:
#!/bin/bash
for j in user@somewhere
do
vmstat 1 10 > output
iostat 1 15 >> output
echo "here are your stats" >> output
mail output $j
done

Hope this helps :) d3funct
zimmer.jon@cfwy.com
The software required `Windows 95 or better', so I installed Linux.

 
Code:
echo "no message contents" | mail -s "subject of hello"  user@someone.com

ciao, mbr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top