Create skeleton of summary email infrastructure.
This commit is contained in:
parent
264925b319
commit
863afdc5b4
1 changed files with 30 additions and 18 deletions
|
@ -43,6 +43,27 @@
|
|||
brmember-format
|
||||
configuration)
|
||||
|
||||
;; TODO - later move to configuration
|
||||
(define *summary-mailto* "rada@brmlab.cz")
|
||||
|
||||
;; Prints email to the console
|
||||
(define (print-notification-email em)
|
||||
(print "### From: " (ldict-ref em 'from "-"))
|
||||
(print "### To: " (ldict-ref em 'to))
|
||||
(print "### Subject: " (ldict-ref em 'subject))
|
||||
(let loop ((lines (ldict-ref em 'body)))
|
||||
(when (not (null? lines))
|
||||
(print (car lines))
|
||||
(loop (cdr lines)))))
|
||||
|
||||
;; Sends notification email - the dictionary representation
|
||||
(define (send-notification-email em)
|
||||
(print "Sending " (ldict-ref em 'subject) " originally to " (ldict-ref em 'to))
|
||||
(send-mail (ldict-ref em 'body)
|
||||
#:from (*email-from*)
|
||||
#:to (ldict-ref em 'to)
|
||||
#:subject (ldict-ref em 'subject)))
|
||||
|
||||
;; Creates reminder email body
|
||||
(define (reminder-email-body mr)
|
||||
(let ((C identity)
|
||||
|
@ -78,24 +99,6 @@
|
|||
(subject . "Připomínka členských příspěvků / Membership fees reminder")
|
||||
(body . ,(reminder-email-body mr)))))
|
||||
|
||||
;; Prints email to the console
|
||||
(define (print-notification-email em)
|
||||
(print "### From: " (ldict-ref em 'from "-"))
|
||||
(print "### To: " (ldict-ref em 'to))
|
||||
(print "### Subject: " (ldict-ref em 'subject))
|
||||
(let loop ((lines (ldict-ref em 'body)))
|
||||
(when (not (null? lines))
|
||||
(print (car lines))
|
||||
(loop (cdr lines)))))
|
||||
|
||||
;; Sends notification email - the dictionary representation
|
||||
(define (send-notification-email em)
|
||||
(print "Sending " (ldict-ref em 'subject) " originally to " (ldict-ref em 'to))
|
||||
(send-mail (ldict-ref em 'body)
|
||||
#:from (*email-from*)
|
||||
#:to (ldict-ref em 'to)
|
||||
#:subject (ldict-ref em 'subject)))
|
||||
|
||||
;; Creates and prints reminder email for given member record
|
||||
(define (make+print-reminder-email mr)
|
||||
(print-notification-email
|
||||
|
@ -106,4 +109,13 @@
|
|||
(let ((em (make-reminder-email mr)))
|
||||
(send-notification-email em)))
|
||||
|
||||
(define (summary-email-body mb)
|
||||
'("yyy"))
|
||||
|
||||
(define (make-summary-email mb)
|
||||
(make-ldict
|
||||
`((to . ,(*summary-mailto*))
|
||||
(subject . "xxx")
|
||||
(body . ,(summary-email-body mb)))))
|
||||
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue