sendmail automation script

Here a little script that will send a email to some people out of a bash script. Not very hard.
 1 #!/bin/bash
2 from="root@microsoft.com"
3 emailtarget="root@sun.com, root@ibm.com"
4 subject="What do you want"
5 sendmail=/usr/sbin/sendmail
6
7
8 CONTENT="
9 Really what you want to put here
10 ----
11 "`fortune`
12
13 msgdate=`date +"%a, %e %Y %T %z"`
14 daemail=$(cat <<!
15 Date: $msgdate
16 From: $from
17 To: $emailtarget
18 Subject: $subject
19 Mime-Version: 1.0
20 X-Mailer: Didi Mail
21
22 $CONTENT
23
24 !)
25
26 echo "$daemail" | $sendmail -t

No comments: