diff options
author | Teddy Wing | 2022-05-08 12:19:33 +0200 |
---|---|---|
committer | Teddy Wing | 2022-05-08 12:19:33 +0200 |
commit | 40ae5a197024253c4db06ac27a1606d21414b693 (patch) | |
tree | 305b1b5fcebb5311aad74afd37af211aa0832ee7 /src/email.lisp | |
parent | 27a205d81647c9df3c6c04f36062b87987d5ae99 (diff) | |
download | wajir-40ae5a197024253c4db06ac27a1606d21414b693.tar.bz2 |
deliver-email: Send email data to program
Allow a "sendmail" program to be configured. If set, `deliver-email`
will spawn the program and write the email its standard input.
We can thus send the email by invoking the external program.
Diffstat (limited to 'src/email.lisp')
-rw-r--r-- | src/email.lisp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/email.lisp b/src/email.lisp index 9e5929c..fe80af1 100644 --- a/src/email.lisp +++ b/src/email.lisp @@ -1,8 +1,17 @@ (in-package :wajir) (defun deliver-email (config issue) + (let ((message (with-output-to-string (message-stream) + (build-email config issue message-stream)))) + + (with-open-stream (sendmail-input (make-string-input-stream message)) + (uiop:run-program (sendmail config) + :output "/tmp/wajir.output" + :input sendmail-input)))) + +(defun build-email (config issue output-stream) (cl-smtp:write-rfc8822-message - *standard-output* + output-stream (format nil "wajir@~A" (uiop:hostname)) `(,(email-to config)) (format-subject issue) |