1
1
#! /bin/bash
2
2
3
+ # Interactively send emails using `mail`'s default way (`sendmail`).
4
+
5
+ # License: GPLv3
6
+
7
+ # Authors:
8
+ # NerdOfCode ( https://github.com/NerdOfCode )
9
+ # Eric Z Ma ( http://www.ericzma.com )
10
+
3
11
# for saving the mail temporarily
4
12
random=$RANDOM
5
13
6
14
# Mail related functionality
7
- mail=$( which mailutils )
15
+ mail=$( which mail )
8
16
mail_status=$?
9
- check_ser=$( which postfix )
17
+ check_ser=$( which sendmail )
10
18
check_ser_status=$?
11
19
temp_d=/tmp/
12
20
mail_ext=.mail
13
21
14
- # Checking GUI related functions
15
- gui_check=" $( startx > /dev/null 2>&1 ) "
16
- gui_status=$?
22
+ # # Checking GUI related functions
23
+ # gui_check="$(startx >/dev/null 2>&1)"
24
+ # gui_status=$?
17
25
18
-
19
- echo -e " THIS PROGRAM IS OF NO WARRANTY!!! I AM NOT RESPONSIBLE FOR ANY
26
+ echo -e " THIS PROGRAM IS OF NO WARRANTY!!! I AM NOT RESPONSIBLE FOR ANY
20
27
MISUSES OF IT. THIS SCRIPT IS SOLELY FOR EDUCATIONAL PURPOSES \n \n"
21
28
sleep 5
22
29
clear
23
30
24
-
25
31
if [ $mail_status != 0 ]
26
32
then
27
33
echo " I am very sorry... But I require the mailutils package to sendmail"
36
42
exit 1
37
43
fi
38
44
39
- if [ $gui_status == 0 ]
40
- then
41
- echo " WARNING!!! Running on home Computer is highly not recommended due to the increased chance of being mislead as spam"
42
- sleep 2
43
- exit 1
44
- fi
45
-
45
+ # if [ $gui_status == 0 ]
46
+ # then
47
+ # echo "WARNING!!! Running on home Computer is highly not recommended due to the increased chance of being mislead as spam"
48
+ # sleep 2
49
+ # exit 1
50
+ # fi
46
51
47
- read -p " Enter from address: " from
52
+ read -p " Enter from address: " from
48
53
read -p " Enter receiving address: " receive
49
54
read -p " Enter subject: " subject
50
55
echo " Enter message in one second: "
@@ -57,7 +62,7 @@ read -p "Ready to send? (yes): " send
57
62
58
63
if [ $send == " yes" ]
59
64
then
60
- echo $body | mail -aFrom: $from -s " $subject " $receive
65
+ echo $body | MAILRC=/dev/null mail -r $from -s " $subject " $receive
61
66
exit 0
62
67
else
63
68
echo " The body of your message was stored here: $temp_d$random$mail_ext "
0 commit comments