summaryrefslogtreecommitdiffstats
path: root/scripts/m2n-prompt.sh
diff options
context:
space:
mode:
authorGab Virebent <noreply@virebent.art>2026-05-26 00:06:05 +0200
committerGab Virebent <noreply@virebent.art>2026-05-26 00:06:05 +0200
commit507ca3a7e3f2d72e583bb26d6817f7deee9188ec (patch)
tree76827026924649ac1d970a48834e3c252b44b068 /scripts/m2n-prompt.sh
parent847759f50596b0d992085aa34d7b5b78057aa7ce (diff)
downloadneomutt-config-507ca3a7e3f2d72e583bb26d6817f7deee9188ec.tar.gz
neomutt-config-507ca3a7e3f2d72e583bb26d6817f7deee9188ec.tar.xz
neomutt-config-507ca3a7e3f2d72e583bb26d6817f7deee9188ec.zip
update: real mail2news config with virebent.art onion addresses, add Tor profile and posting script
- accounts/mail2news: real onion SMTP endpoint, ephemeral nobody@virebent.invalid From - scripts/m2n-prompt.sh: working interactive posting script (swaks + torsocks) - neomuttrc.tor: Tor profile sourcing mail2news account, F9 macro binding - neomuttrc.common: shared UI/GPG/sidebar base config - README: rewritten in English, documents actual setup and gateway address
Diffstat (limited to 'scripts/m2n-prompt.sh')
-rw-r--r--scripts/m2n-prompt.sh82
1 files changed, 82 insertions, 0 deletions
diff --git a/scripts/m2n-prompt.sh b/scripts/m2n-prompt.sh
new file mode 100644
index 0000000..d57db96
--- /dev/null
+++ b/scripts/m2n-prompt.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+# Mail2News posting script — NeoMutt + torsocks + swaks
+# Bind to F9 in neomuttrc.tor:
+# macro index,pager <F9> "<shell-escape>~/.config/neomutt/m2n-prompt.sh<enter>" "Post to Usenet"
+set -euo pipefail
+
+M2N_TO="mail2news@xilb7y4kj6u6qfo45o3yk2kilfv54ffukzei3puonuqlncy7cn2afwyd.onion"
+SMTP_HOST="xilb7y4kj6u6qfo45o3yk2kilfv54ffukzei3puonuqlncy7cn2afwyd.onion"
+SMTP_PORT="25"
+FROM="nobody@virebent.invalid"
+
+clear
+echo "=== MAIL2NEWS — Usenet Post ==="
+echo
+
+printf "Newsgroup(s) [comma-separated]: "
+read -r NEWSGROUP
+[ -z "$NEWSGROUP" ] && echo "Aborted." && exit 1
+NEWSGROUP=$(echo "$NEWSGROUP" | sed 's/ *, */,/g')
+
+printf "Subject: "
+read -r SUBJECT
+[ -z "$SUBJECT" ] && echo "Aborted." && exit 1
+
+REFERENCES=""
+if echo "$SUBJECT" | grep -qi "^re:"; then
+ printf "References (Message-ID of original): "
+ read -r REFERENCES
+fi
+
+MSGFILE=$(mktemp /tmp/m2n-body.XXXXXX)
+echo "" > "$MSGFILE"
+echo "-- " >> "$MSGFILE"
+echo "posted via virebent.art mail2news" >> "$MSGFILE"
+
+${EDITOR:-vim} "$MSGFILE"
+
+DRAFTFILE=$(mktemp /tmp/m2n-draft.XXXXXX)
+{
+ printf "To: %s\n" "$M2N_TO"
+ printf "From: %s\n" "$FROM"
+ printf "Subject: %s\n" "$SUBJECT"
+ [ -n "$REFERENCES" ] && printf "References: %s\n" "$REFERENCES"
+ printf "Newsgroups: %s\n" "$NEWSGROUP"
+ printf "\n"
+ cat "$MSGFILE"
+} > "$DRAFTFILE"
+
+clear
+echo "=== REVIEW ==="
+cat "$DRAFTFILE"
+echo
+printf "[s]end [e]dit [q]uit: "
+read -r CHOICE
+
+case "$CHOICE" in
+ e|E) ${EDITOR:-vim} "$DRAFTFILE" ;;
+ q|Q) rm -f "$MSGFILE" "$DRAFTFILE"; echo "Cancelled."; exit 0 ;;
+esac
+
+echo
+echo "Sending via Tor..."
+
+torsocks swaks \
+ --server "${SMTP_HOST}:${SMTP_PORT}" \
+ --from "$FROM" \
+ --to "$M2N_TO" \
+ --data "@${DRAFTFILE}" \
+ --timeout 60 \
+ 2>&1 | tee /tmp/m2n-smtp.log
+
+if grep -q "250 " /tmp/m2n-smtp.log; then
+ echo
+ echo "Sent to: $NEWSGROUP"
+else
+ echo
+ echo "ERROR — check /tmp/m2n-smtp.log"
+fi
+
+rm -f "$MSGFILE" "$DRAFTFILE"
+printf "\nPress Enter to return to NeoMutt..."
+read -r