[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] create a "send plain text/pdf email with current header" functio
From: |
Eric Abrahamsen |
Subject: |
Re: [O] create a "send plain text/pdf email with current header" function? |
Date: |
Thu, 06 Aug 2015 14:24:17 +0800 |
User-agent: |
Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) |
Xebar Saram <address@hidden> writes:
> Perfect! (as always i might add John ;))
>
> thx so muxh
Just to add to the mess, here's something I've used before -- kind of a
poor man's mail merge, to send spam (not really spam!).
(defvar my-spam-sent-names nil
"Make sure that, even if we have to run this multiple times, people
don't get spammed more than once.")
(defun my-spam-headline ()
(org-narrow-to-subtree)
(cl-flet ((mp (p) (org-entry-get nil p t)))
(let* ((org-inhibit-logging t)
(file (buffer-file-name (current-buffer)))
(subject "Sign up for my stuff")
(name (mp "NAME"))
(to (mp "MAIL_TO"))
(from "Eric Abrahamsen <address@hidden>")
(salutation (mp "SALUTATION"))
(body (replace-regexp-in-string "XXXX" salutation letter-text t)))
(when (equal "PITCH" (mp "TODO"))
(unless (member name my-spam-sent-names)
(save-excursion
(org-mime-compose body 'html file (concat name " <" to ">")
subject `((from . ,from)))
(message-send-and-exit))
(push name my-spam-sent-names)
(org-todo "WAITING")))))
(setq org-map-continue-from (point-max))
(widen))
(defun my-spam-tree ()
(interactive)
(let ((letter-text "long string with XXXXs in it."))
(org-map-entries #'my-spam-subtree "TODO=\"PITCH\"" 'tree)))