From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/88880 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.gnus.general Subject: local ML with Gnus Date: Thu, 28 Nov 2019 05:46:09 +0100 Message-ID: <86imn41ucu.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="7997"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) To: ding@gnus.org Original-X-From: ding-owner+M37084@lists.math.uh.edu Thu Nov 28 05:47:25 2019 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from lists1.math.uh.edu ([129.7.128.208]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iaBi8-0001vS-Vx for ding-account@gmane.org; Thu, 28 Nov 2019 05:47:25 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.92.3) (envelope-from ) id 1iaBhL-0005zt-GB; Wed, 27 Nov 2019 22:46:35 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by lists1.math.uh.edu with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1iaBhD-0005uQ-Qx for ding@lists.math.uh.edu; Wed, 27 Nov 2019 22:46:27 -0600 Original-Received: from quimby.gnus.org ([95.216.78.240]) by mx1.math.uh.edu with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1iaBhB-0001eS-1y for ding@lists.math.uh.edu; Wed, 27 Nov 2019 22:46:27 -0600 Original-Received: from 195-159-176-226.customer.powertech.no ([195.159.176.226] helo=blaine.gmane.org) by quimby.gnus.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iaBh3-0001Xu-M4 for ding@gnus.org; Thu, 28 Nov 2019 05:46:20 +0100 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1iaBh2-0000is-Tn for ding@gnus.org; Thu, 28 Nov 2019 05:46:16 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Mail-Copies-To: never Cancel-Lock: sha1:lp4TeXXWdh4bixBOPjXIQJz2bU4= List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:88880 Archived-At: I think (?) I have succeed in writing software for a local mailing list based on Gnus! The code is hopefully understandable just be reading... Please help out to improve it tho, if you see something. Problems that I've already detected are indicated with comments. The main style problem is of course that I do this as a human would, only that is all automated. While that seems to work fine, one would wish it to be on the all-computer side of things, in particular it would execute entirely in the background. That's probably not that difficult to do if you know the right functions... so yeah, that can be improved :) File: https://dataswamp.org/~incal/emacs-init/gnus/mail-to-many.el ;;; -*- lexical-binding: t -*- ;; This file: http://user.it.uu.se/~embe8573/emacs-init/gnus/mail-to-many.el ;; https://dataswamp.org/~incal/emacs-init/gnus/mail-to-many.el ;; Check out: ;; http://user.it.uu.se/~embe8573/emacs-init/gnus/mailrc.el (require 'cl-lib) (require 'gnus-art) (require 'gnus-msg) (require 'gnus-sum) (require 'message) (defvar mtm-source-group) (setq mtm-source-group "nnml:mail.obi-one") (defvar mtm-test-receivers) (setq mtm-test-receivers '( "JH1 " "JH2 " "JH3 " )) (defun mtm-test () (interactive) (mtm-send-random-article-to-list mtm-source-group mtm-test-receivers) ) ;; (mtm-test) (defun mtm-send-random-article-to-list (group list) (save-window-excursion ; still, annoying buffer flash-by (mtm-open-group group) (gnus-summary-goto-random-article) (gnus-summary-select-article-buffer) (let ((body (gnus-article-get-body)) (subject (gnus-fetch-field "Subject")) ; must be include in `gnus-visible-headers' ) (send-mail-to-many list subject body) ))) (defun mtm-open-group (group) (gnus-group-read-group nil nil group) ) (defun gnus-summary-goto-random-article () (interactive) (let*((ids gnus-newsgroup-articles) (article-count (length ids) ) (random-position (random article-count)) (article (nth random-position ids)) ) (gnus-summary-goto-article article) )) (defun gnus-article-get-body () (when (article-goto-body) (buffer-substring-no-properties (point) (point-max)) )) ;; TODO: delete mail (defun send-mail-to-many (to-list subject body) (cl-dolist (to to-list) (send-mail-to to subject body) )) (defun send-mail-to (to subject body) (gnus-post-news 'post "") (message-goto-to) (insert to) (message-goto-subject) (insert subject) (message-goto-body) (insert body) (message-send-and-exit) ) (provide 'mail-to-many) -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal