diff options
author | Sacha Chua <sacha@sachachua.com> | 2022-10-30 19:25:19 -0400 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2022-10-30 19:25:19 -0400 |
commit | def383660144df547b7ce41cf4322222e39336d1 (patch) | |
tree | e74a15a6da8f88a4b475759cf06f7a090c4de9bd /emacsconf-mail.el | |
parent | 309b9937f416a349c3fb05fbed607c93f37ef3a9 (diff) | |
download | emacsconf-el-def383660144df547b7ce41cf4322222e39336d1.tar.xz emacsconf-el-def383660144df547b7ce41cf4322222e39336d1.zip |
Publishing updates
Diffstat (limited to 'emacsconf-mail.el')
-rw-r--r-- | emacsconf-mail.el | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/emacsconf-mail.el b/emacsconf-mail.el index 12ba105..8322b1f 100644 --- a/emacsconf-mail.el +++ b/emacsconf-mail.el @@ -36,10 +36,14 @@ (defun emacsconf-mail-prepare (template email attrs) (compose-mail email - (emacsconf-replace-plist-in-string attrs (plist-get template :subject)) - `(("Reply-To" . ,(emacsconf-replace-plist-in-string attrs (plist-get template :reply-to))) - ("Mail-Followup-To" . ,(emacsconf-replace-plist-in-string attrs (plist-get template :mail-followup-to))) - ("Cc" . ,(plist-get template :cc)))) + (emacsconf-replace-plist-in-string attrs (or (plist-get template :subject) "")) + (delq nil + (list + (if (plist-get template :reply-to) (cons "Reply-To" (emacsconf-replace-plist-in-string attrs (plist-get template :reply-to)))) + (if (plist-get template :mail-followup-to) + (cons "Mail-Followup-To" (emacsconf-replace-plist-in-string attrs (plist-get template :mail-followup-to)))) + (if (plist-get template :cc) + (cons "Cc" (emacsconf-replace-plist-in-string attrs (plist-get template :cc))))))) (message-sort-headers) (message-goto-body) (save-excursion (insert (emacsconf-replace-plist-in-string attrs (plist-get template :body))) @@ -56,6 +60,17 @@ (mail-func (plist-get template :function))) (funcall mail-func user-mail-address template))) +(defun emacsconf-mail-template-to-volunteer (volunteer) + "Prompt for a volunteer and e-mail current template to them." + (interactive (list (with-current-buffer (find-file-noselect emacsconf-org-file)))) + (let ((template (if (org-entry-get (point) "EMAIL_ID") + (emacsconf-mail-merge-get-template-from-subtree) + (emacsconf-mail-merge-get-template + (completing-read "Template: " (org-property-values "EMAIL_ID"))))) + (volunteers (emacsconf-get-volunteer-info)) + (mail-func (plist-get template :function))) + (funcall mail-func (emacsconf-complete-volunteer) template))) + (defun emacsconf-mail-template-to-group () "Prompt for a speaker and e-mail current template to them." (interactive) @@ -153,8 +168,17 @@ (defun emacsconf-mail-merge-get-template (id) "Return the information for the e-mail template with EMAIL_ID set to ID." (save-excursion - (goto-char (org-find-property "EMAIL_ID" id)) - (emacsconf-mail-merge-get-template-from-subtree))) + (let ((char (org-find-property "EMAIL_ID" id))) + (if char + (progn (goto-char char) (emacsconf-mail-merge-get-template-from-subtree)) + (with-current-buffer + (find-file-noselect (expand-file-name "organizers-notebook/index.org" (expand-file-name emacsconf-year emacsconf-directory))) + (setq char (org-find-property "EMAIL_ID" id)) + (if char + (progn + (goto-char char) + (emacsconf-mail-merge-get-template-from-subtree)) + (error "Could not find template %s" id))))))) (defun emacsconf-mail-merge-fill (string) "Fill in the values for STRING using the properties at point. |