summary refs log tree commit diff
path: root/mcomp
diff options
context:
space:
mode:
Diffstat (limited to 'mcomp')
-rwxr-xr-xmcomp19
1 files changed, 12 insertions, 7 deletions
diff --git a/mcomp b/mcomp
index 1917ec6..6fdb433 100755
--- a/mcomp
+++ b/mcomp
@@ -109,16 +109,21 @@ while :; do
 				c=
 			fi
 		else
-			if sendmail -t <$draft; then
-				if [ "$outbox" ]; then
-					mflag -d $draft
+			if mmime -c <$draft; then
+				if sendmail -t <$draft; then
+					if [ "$outbox" ]; then
+						mflag -d $draft
+					else
+						rm $draft
+					fi
+					exit 0
 				else
-					rm $draft
+					echo "mcomp: sendmail failed, kept draft $draft"
+					exit 2
 				fi
-				exit 0
 			else
-				echo "mcomp: sendmail failed, kept draft $draft"
-				exit 2
+				echo "mcomp: message needs to be MIME-encoded first."
+				c=
 			fi
 		fi
 		;;