Debian Codegraph @

tools/testing/reporting/scripts/textMail

raw
1 #!/bin/bash
2
3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements. See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to you under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18 if [ "$1" == "" ]
19 then
20 echo "Missing Subject"
21 exit
22 fi
23 if [ "$2" == "" ]
24 then
25 echo "Missing toMailAdr"
26 exit
27 fi
28 if [ "$3" == "" ]
29 then
30 echo "Missing File(s)"
31 echo "NB! Must be plain text files with nothing that the shell might try to interpret!"
32 exit
33 fi
34 SUBJECT=$1
35 TO=$2
36 FILELIST=$3
37
38 # echo "Creating sendmail file"
39
40 echo "Subject: ${SUBJECT}" >> sendmailfile$$
41 echo "To: ${TO}" >> sendmailfile$$
42 echo "From: [email protected]" >> sendmailfile$$
43
44 for FILE in ${FILELIST}
45 do
46
47 # echo "File: ${FILE}:" >> sendmailfile$$
48 # echo "" >> sendmailfile$$
49
50 cat ${FILE} >> sendmailfile$$
51
52 # echo "-------" >> sendmailfile$$
53 echo "" >> sendmailfile$$
54
55 done
56
57 cat sendmailfile$$
58
59 echo "Sending mail w/Subject '"${SUBJECT}"' to ${TO}"
60 /usr/lib/sendmail -t < sendmailfile$$
61
62
63 rm sendmailfile$$