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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to send email

Status
Not open for further replies.

emmons

Technical User
Oct 9, 2002
114
do you know how I could write a script to email someone when an event occurs?
 
What kind of event do you mean?

The command for sending mail is 'mail' ;-)
 
you can create a simple shell script to do that.
Just use vi and create a file, inside the file you will put the necessary proccesses, when the event occurs "mail admin@admin"
 
/usr/sbin/sendmail -oi -t < $1

$1 is the text file I use. As I am the one who creates the text file, I can put the following in:

From: Pen Name <Stoke@slightlysillyaddress.com>
To: Stoke <Stoke@sillyemailaddress.com>
Subject: Email Success!

Message goes in here.
~~~~~~~~~~~~~~~~~~~~~
I found this on the internet and tried it and it worked. Now the event is to figure out how much disk space each user is using and when it reaches a certain limit to mail a message that says to please erase some messages.

I am just getting started trying to figure it out. I would have to use a variable name for the user so the above approach may not work so well.

I use qmail if that matters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top