From: Bob Newell <bobnewell@bobnewell.net>
To: info-gnus-english@gnu.org
Subject: Re: Have message-ID set by my email server rather than by Message
Date: Sat, 09 Dec 2023 11:30:44 -1000 [thread overview]
Message-ID: <cl8depk30.rcdirr8zgq4p@uh2lo0l.56zb357.org> (raw)
In-Reply-To: <cf5e5e34a1f78479827c599bbd7f258c@posteo.net> (rameiko's message of "Sat, 09 Dec 2023 20:21:13 +0000")
Not 100% relevant, and I have posted an earlier version
before, but I have fun with the following which completely
randomizes the Message ID and user agent for every email I
send from gnus. (Sometimes you actually want this; think
about it!) However some SMTP servers rudely go ahead and
substitute their own Message ID for mine. Bad manners indeed.
Gmail fortunately does not.
;;; Fully anonymize/randomize FQDN.
(defun munge-message-id (orig-fun &rest args)
"Make a random FQDN and User Agent"
(let* (
(alpha "abcdefghijklmnopqrstuvwxyz0123456789")
(domain '("com" "org" "net" "info" "us"))
(part1 "")
(part2 "")
(part3 "")
(part4 "")
(part5 "")
num0 rnum)
;;; Temporary. Not in right place at all.
(munge-user-agent)
;;; FQDN.
;;; Front half.
(setq num0 (+ 8 (random 6)))
(while (> num0 0)
(setq rnum (random 35))
(setq part1 (concat part1 (substring alpha rnum (+ 1 rnum))))
(setq num0 (- num0 1))
)
(setq num0 (+ 8 (random 6)))
(while (> num0 0)
(setq rnum (random 35))
(setq part2 (concat part2 (substring alpha rnum (+ 1 rnum))))
(setq num0 (- num0 1))
)
;;; Back half.
(setq num0 (+ 4 (random 6)))
(while (> num0 0)
(setq rnum (random 35))
(setq part3 (concat part3 (substring alpha rnum (+ 1 rnum))))
(setq num0 (- num0 1))
)
(setq num0 (+ 4 (random 6)))
(while (> num0 0)
(setq rnum (random 35))
(setq part4 (concat part4 (substring alpha rnum (+ 1 rnum))))
(setq num0 (- num0 1))
)
;;; TLD.
(setq part5 (nth (random 4) domain))
;;; Build the message-id.
(concat "<" part1 "." part2 "@" part3 "." part4 "." part5 ">")
)
)
(advice-add 'message-make-message-id :around #'munge-message-id)
;;; Semi-randomize User-Agent.
(defun munge-user-agent ()
"Change user-agent to semi-random string"
(let* ( (agents '("Mozilla" "Chrome" "Safari" "Brave" "Vivaldi" "Edge"))
(versions '("5.0" "5.5" "6.0" "6.5" "4.5" "7.0")))
(setq gnus-user-agent (concat (nth (random 5) agents) "/" (nth (random 5) versions)))))
--
Bob Newell
Honolulu, Hawai`i
- Via GNU/Linux/Emacs/Gnus/BBDB
next prev parent reply other threads:[~2023-12-09 21:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-08 18:44 rameiko87
2023-12-09 7:03 ` Lars-Johan Liman
2023-12-09 14:16 ` rameiko87
2023-12-09 16:57 ` Arash Esbati
2023-12-09 20:21 ` rameiko87
2023-12-09 21:30 ` Bob Newell [this message]
2023-12-11 6:35 ` Arash Esbati
2023-12-11 9:01 ` Lars-Johan Liman
2023-12-11 14:42 ` Otto J. Makela
2023-12-11 21:23 ` rameiko87
2023-12-11 21:31 ` rameiko87
2023-12-10 11:05 ` Lars-Johan Liman
2023-12-11 21:07 ` rameiko87
2023-12-11 21:22 ` Adam Sjøgren
2023-12-11 22:25 ` rameiko87
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cl8depk30.rcdirr8zgq4p@uh2lo0l.56zb357.org \
--to=bobnewell@bobnewell.net \
--cc=info-gnus-english@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).