Skip to content

Commit a5b25d5

Browse files
committed
minor revisions to sendmail.sh
1 parent 6b01bf4 commit a5b25d5

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

script/sendmail.sh

100644100755
+22-17
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
#!/bin/bash
22

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+
311
#for saving the mail temporarily
412
random=$RANDOM
513

614
#Mail related functionality
7-
mail=$(which mailutils)
15+
mail=$(which mail)
816
mail_status=$?
9-
check_ser=$(which postfix)
17+
check_ser=$(which sendmail)
1018
check_ser_status=$?
1119
temp_d=/tmp/
1220
mail_ext=.mail
1321

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=$?
1725

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
2027
MISUSES OF IT. THIS SCRIPT IS SOLELY FOR EDUCATIONAL PURPOSES \n \n"
2128
sleep 5
2229
clear
2330

24-
2531
if [ $mail_status != 0 ]
2632
then
2733
echo "I am very sorry... But I require the mailutils package to sendmail"
@@ -36,15 +42,14 @@ then
3642
exit 1
3743
fi
3844

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
4651

47-
read -p "Enter from address: " from
52+
read -p "Enter from address: " from
4853
read -p "Enter receiving address: " receive
4954
read -p "Enter subject: " subject
5055
echo "Enter message in one second: "
@@ -57,7 +62,7 @@ read -p "Ready to send? (yes): " send
5762

5863
if [ $send == "yes" ]
5964
then
60-
echo $body | mail -aFrom:$from -s "$subject" $receive
65+
echo $body | MAILRC=/dev/null mail -r $from -s "$subject" $receive
6166
exit 0
6267
else
6368
echo "The body of your message was stored here: $temp_d$random$mail_ext"

0 commit comments

Comments
 (0)