diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-01-28 16:09:39 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-01-28 16:09:39 +0100 |
commit | fd1588fc1068dd601834b7cfb73c16c50db97a22 (patch) | |
tree | 0c15e16d9bb76af0867c2223e42fa5d28a24917a | |
parent | start.txt: Mention cgit. (diff) |
code: Add 'send-en-masse' program.
* code/send-en-masse.scm: New file.
-rw-r--r-- | code/send-en-masse.scm | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/code/send-en-masse.scm b/code/send-en-masse.scm new file mode 100644 index 0000000..36d3682 --- /dev/null +++ b/code/send-en-masse.scm | |||
@@ -0,0 +1,51 @@ | |||
1 | ;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org> | ||
2 | ;;; | ||
3 | ;;; This program is free software; you can redistribute it and/or modify it | ||
4 | ;;; under the terms of the GNU General Public License as published by | ||
5 | ;;; the Free Software Foundation; either version 3 of the License, or (at | ||
6 | ;;; your option) any later version. | ||
7 | ;;; | ||
8 | ;;; This program is distributed in the hope that it will be useful, but | ||
9 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | ;;; GNU General Public License for more details. | ||
12 | ;;; | ||
13 | ;;; You should have received a copy of the GNU General Public License | ||
14 | ;;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | |||
16 | ;;; Run with: | ||
17 | ;;; | ||
18 | ;;; guix environment --ad-hoc guile mailutils -- \ | ||
19 | ;;; guile -L modules -e main -s send-en-masse.scm | ||
20 | ;;; | ||
21 | |||
22 | (use-modules (email) | ||
23 | (rnrs io ports) | ||
24 | ((mailutils mailutils) #:select (mu-message-set-header))) | ||
25 | |||
26 | (define (endorsement-message) | ||
27 | "Return the endorsement message, signed." | ||
28 | (let ((text (call-with-input-file "sc-email.txt" get-string-all))) | ||
29 | (compose-message ;;"Ludovic Courtès <ludo@gnu.org>" | ||
30 | "=?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@gnu.org>" | ||
31 | "ludo@gnu.org" | ||
32 | #:subject | ||
33 | "Endorsement of the GNU Social Contract" | ||
34 | #:text text | ||
35 | #:reply-to "social-contract@gnu.tools" | ||
36 | #:user-agent "GNU Guile + GNU Mailutils" | ||
37 | #:sign? #t))) | ||
38 | |||
39 | (define %maintainers | ||
40 | ;; (call-with-input-file "email-addresses.scm" read) | ||
41 | '("ludo+test@gnu.org")) | ||
42 | |||
43 | (define (main . args) | ||
44 | (let ((message (endorsement-message))) | ||
45 | (format #t "emailing ~a people~%" (length %maintainers)) | ||
46 | (for-each (lambda (address) | ||
47 | (format #t "emailing '~a'...~%" address) | ||
48 | (mu-message-set-header message "To" address #t) | ||
49 | (send-message message) | ||
50 | (sleep 1)) | ||
51 | %maintainers))) | ||