From d41201c6418b3000607f24a160328c6623d6dd71 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Thu, 19 Aug 2021 23:44:30 +0000
Subject: [PATCH] use curl to email instead of sendmail backend

---
 vars-default.sh |    4 +++-
 main.sh         |   20 ++++++++++++--------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/main.sh b/main.sh
index 81b5cf4..76217c9 100755
--- a/main.sh
+++ b/main.sh
@@ -339,14 +339,18 @@
 }
 
 function send_email {
-	(
-	echo "From: $FROM_EMAIL"
-	echo "To: $EMAIL"
-	echo "Subject: Build errors"
-	echo ""
-	echo "There were build errors for the build of $REPONAME at $(date), please address them soon."
-	echo "The errors were: $@"
-	) | sendmail -t
+	curl -s --url "smtp://$EMAIL_HOST" --ssl-reqd \
+		--mail-from "$FROM_EMAIL" \
+		--mail-rcpt "$TO_EMAIL" \
+		--user "$EMAIL_USER" \
+		-T <(
+			echo "From: $FROM_EMAIL"
+			echo "To: $TO_EMAIL"
+			echo "Subject: Build errors"
+			echo ""
+			echo "There were build errors for the build of $REPONAME at $(date), please address them soon."
+			echo "The errors were: $@"
+		)
 }
 
 case $1 in
diff --git a/vars-default.sh b/vars-default.sh
index c84a638..a2457dc 100644
--- a/vars-default.sh
+++ b/vars-default.sh
@@ -5,8 +5,10 @@
 export PKGEXT='.pkg.tar.zst'
 export SRCEXT='.src.tar.bz2'
 export PACKAGER="John Doe <jd@change.me>"
-EMAIL=""
+TO_EMAIL=""
 FROM_EMAIL="$(whoami)@$(localhost)"
+EMAIL_HOST="server_url:port"
+EMAIL_USER="user:pass"
 UPDATE=N
 PARALLEL=N
 QUIET=N

--
Gitblit v1.10.0