You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
851 B
35 lines
851 B
#!/bin/sh |
|
# |
|
# Mailing list UPdater |
|
# Run `mup` to broadcast latest post or `mup my-post.html` for a specific post |
|
|
|
### CHANGE |
|
domain='example.org' |
|
host="noreply@$domain" |
|
|
|
## Change |
|
webroot="/var/www/example" |
|
postdir="posts" |
|
path="$webroot/$postdir" |
|
|
|
# Most recent post/announcement if no argument given |
|
[ -z $1 ] && post="https://$domain/$postdir/$(ls -t $path/*.html | head -1)" && \ |
|
html="$path/$(ls -t $path/*.html | head -1)" |
|
# Else your html post is set here |
|
[ ! -z $1 ] && post="https://$domain/$postdir/$1" && html="$path/$1" |
|
|
|
subject="$(sed -n 's/<title>\(.*\)<\/title>/\1/Ip' "$html")" |
|
subject=$(echo $subject | sed 's/–/-/') |
|
|
|
IFS='' |
|
content=$(lynx -dump $post) |
|
|
|
## Change to path of emails.txt |
|
list="$webroot/ml/emails.txt" |
|
|
|
while read recipient |
|
do |
|
echo $content | mailx -r $host -s "$subject" $recipient |
|
done < $list |
|
|
|
exit 0;
|
|
|