summaryrefslogtreecommitdiffstats
path: root/code/send-en-masse.scm
blob: 36d3682d9e3528d89438cb95745203b9488f717c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This program is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Run with:
;;;
;;;  guix environment --ad-hoc guile mailutils -- \
;;;    guile -L modules -e main -s send-en-masse.scm
;;;

(use-modules (email)
             (rnrs io ports)
             ((mailutils mailutils) #:select (mu-message-set-header)))

(define (endorsement-message)
  "Return the endorsement message, signed."
  (let ((text (call-with-input-file "sc-email.txt" get-string-all)))
    (compose-message ;;"Ludovic Courtès <ludo@gnu.org>"
                     "=?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@gnu.org>"
                     "ludo@gnu.org"
                     #:subject
                     "Endorsement of the GNU Social Contract"
                     #:text text
                     #:reply-to "social-contract@gnu.tools"
                     #:user-agent "GNU Guile + GNU Mailutils"
                     #:sign? #t)))

(define %maintainers
  ;; (call-with-input-file "email-addresses.scm" read)
  '("ludo+test@gnu.org"))

(define (main . args)
  (let ((message (endorsement-message)))
    (format #t "emailing ~a people~%" (length %maintainers))
    (for-each (lambda (address)
                (format #t "emailing '~a'...~%" address)
                (mu-message-set-header message "To" address #t)
                (send-message message)
                (sleep 1))
              %maintainers)))