Link new mail utility.
This commit is contained in:
parent
5a406460a2
commit
167dc90a65
2 changed files with 31 additions and 13 deletions
|
|
@ -32,14 +32,26 @@
|
|||
)
|
||||
|
||||
(import scheme
|
||||
(chicken base)
|
||||
(chicken keyword)
|
||||
util-io)
|
||||
|
||||
;; Sends an email using the UNIX mail(1) utility.
|
||||
(define (send-mail body-lines . args)
|
||||
;; from - single string
|
||||
;; to - single string or list of strings
|
||||
;; subject - single string
|
||||
#f)
|
||||
(let ((from (get-keyword #:from args))
|
||||
(to (get-keyword #:to args))
|
||||
(subject (get-keyword #:subject args)))
|
||||
(when (not to)
|
||||
(error 'send-mail "requires #:to argument"))
|
||||
(when (not subject)
|
||||
(error 'send-mail "requires #:subject argument"))
|
||||
(let ((tos (if (list? to)
|
||||
to
|
||||
(list to))))
|
||||
(apply process-send/recv
|
||||
"mail"
|
||||
"-r" from
|
||||
"-s" subject
|
||||
tos))))
|
||||
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue