commit e4056979003442010880a8e4f926aa3775caea9b
parent 59524d96d217a4d8668d4799dca23aa909d8d3bf
Author: Christoph Lohmann <20h@r-36.net>
Date: Sat, 10 Oct 2020 14:47:57 +0200
Fix @ in author and add URL and Enclosure support.
Diffstat:
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/sfeed_sendmail b/sfeed_sendmail
@@ -1,6 +1,6 @@
#!/bin/sh
-#set -x
+set -x
if [ $# -lt 1 ];
then
@@ -27,7 +27,14 @@ do
[ -z "${timestamp}" ] && timestamp="$(TZ=UTC date +%s)"
timestamp="$(TZ=UTC date -R -d @${timestamp})"
[ -z "${title}" ] && title="$(printf "%s\n" "${content}" | cut -b 30-)"
- fromaddr="$(printf "%s none@none.no" "${author}")"
+ case "${author}" in
+ *@*)
+ fromaddr="${author}"
+ ;;
+ *)
+ fromaddr="$(printf "%s none@none.no" "${author}")"
+ ;;
+ esac
{
printf "From: %s\r\n" "${fromaddr}"
@@ -58,6 +65,9 @@ do
printf "%s\n" "${content}" \
| sed 's,\\n,\n,g; s,\\t,\t,g; s,\\\\,\\,g'
fi
+
+ [ -n "${link}" ] && printf "URL: %s\n" "${link}"
+ [ -n "${enclosure}" ] && printf "Enclosure: %s\n" "${enclosure}"
#} | cat
} | $SENDMAILCMD "${fromaddr}" "${toaddr}"