forked from TeMPOraL/alice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail.lisp
24 lines (20 loc) · 1.11 KB
/
email.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(in-package #:alice)
(defparameter *mailgun-domain* "")
(defparameter *mailgun-key* "")
(defun send-email (where-to text)
(if (ignore-errors (drakma:http-request (concatenate 'string "https://api.mailgun.net/v2/" *mailgun-domain* "/messages")
:method :post
:basic-authorization `("api" ,*mailgun-key*)
:parameters `(("from" . ,(concatenate 'string "Alice Margatroid <alice.margatroid@" *mailgun-domain* ">"))
("to" . ,where-to)
("subject" . "Alice Margatroid here; got a notification for you.")
("text" . ,text))
:external-format-out :UTF-8))
;;
:notification-sent
:failed-in-sending-notification))
;;; FIXME maybe move output message determination somewhere elsew
;;; notifications plug-in
(defun make-email-notifier (email)
(lambda (memo)
(send-email email (text memo))))