emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-orgmode@gnu.org
Subject: Re: create a "send plain text/pdf email with current header" function?
Date: Thu, 06 Aug 2015 14:24:17 +0800	[thread overview]
Message-ID: <871tfhylwu.fsf@ericabrahamsen.net> (raw)
In-Reply-To: CAOQHXPr-c_1y9EeHL9V8UcGt=jugntOCarWpSqDq9J-FVrN0HA@mail.gmail.com

Xebar Saram <zeltakc@gmail.com> 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 <eric@ericabrahamsen.net>")
	   (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)))

  reply	other threads:[~2015-08-06  6:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-01 15:24 create a "send plain text/pdf email with current header" function? John Kitchin
2015-08-01 17:43 ` Matt Price
2015-08-05 11:34 ` Xebar Saram
2015-08-05 18:38   ` John Kitchin
2015-08-06  4:42     ` Xebar Saram
2015-08-06  6:24       ` Eric Abrahamsen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-08-01 14:49 Xebar Saram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871tfhylwu.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).