From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/79060 Path: news.gmane.org!not-for-mail From: lee Newsgroups: gmane.emacs.gnus.general Subject: Re: using templates to write articles (email) Date: Fri, 10 Jun 2011 22:41:55 +0200 Message-ID: <8762od179s.fsf@yun.yagibdah.de> References: <87fwnhd0mx.fsf@yun.yagibdah.de> <87ei318qmy.fsf@ericabrahamsen.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1307756116 16544 80.91.229.12 (11 Jun 2011 01:35:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 11 Jun 2011 01:35:16 +0000 (UTC) Cc: ding@gnus.org To: Eric Abrahamsen Original-X-From: ding-owner+M27359@lists.math.uh.edu Sat Jun 11 03:35:11 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QVD6V-00072o-FG for ding-account@gmane.org; Sat, 11 Jun 2011 03:35:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1QVD5D-0002ss-ET; Fri, 10 Jun 2011 20:33:51 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1QVD5C-0002sg-5y for ding@lists.math.uh.edu; Fri, 10 Jun 2011 20:33:50 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1QVD52-0000nt-0V for ding@lists.math.uh.edu; Fri, 10 Jun 2011 20:33:50 -0500 Original-Received: from static.73.179.46.78.clients.your-server.de ([78.46.179.73]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1QVD50-0000hO-I6 for ding@gnus.org; Sat, 11 Jun 2011 03:33:38 +0200 Original-Received: from lee by static.73.179.46.78.clients.your-server.de with local (Exim 4.76) (envelope-from ) id 1QVD4x-0001yh-UQ; Sat, 11 Jun 2011 03:33:35 +0200 Mail-Followup-To: Eric Abrahamsen , ding@gnus.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-Spam-Score: 1.6 (+) X-Spam-Report: SpamAssassin (3.3.1 2010-03-16) analysis follows Bayesian score: 0.0000 Ham tokens: 0.000-1671--6495h-0s--0d--H*UA:Emacs, 0.000-1511--5871h-0s--0d--H*u:Emacs, 0.000-1410--5478h-0s--0d--H*UA:Gnus, 0.000-1409--5477h-0s--0d--H*u:Gnus, 0.000-1354--5264h-0s--0d--H*u:linux Spam tokens: 0.965-5205--1316h-50617s--0d--H*r:quimby.gnus.org, 0.910-173--206h-2939s--0d--H*r:sk:static., 0.902-2624--3927h-50847s--0d--HX-Spam-Relays-External:quimby.gnus.org, 0.902-2624--3927h-50847s--0d--H*RU:quimby.gnus.org, 0.901-2342--3554h-45766s--0d--H*Ad:D*gnus.org Autolearn status: no -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 1.6 DATE_IN_PAST_03_06 Date: is 3 to 6 hours before Received: date -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 2.0 HELO_DYNAMIC_IPADDR Relay HELO'd using suspicious hostname (IP addr 1) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:79060 Archived-At: Eric Abrahamsen writes: > lee writes: > >> So far, I=C2=B4ve created templates as plain text files, and when writin= g an >> email from the template, I delete everything in the composing buffer and >> do an insert-file to read the template into the buffer. This works fine, >> and perhaps there=C2=B4s some support for templates already built in, wh= ich >> would make using templates more convenient? > > > (defun my-mail-merge (names buffer subject from marker) > "This is a bit of a mess, but it's something like a mail merge. > > Variable containing names should be a list of two-element lists, > in the format (\"Name\" \"email address\")." > (interactive "XVariable containing names: \nbBuffer to slurp: \nsSubjec= t: \nsFrom: \nsMarker: ") > (dolist (n names) > (compose-mail (nth 1 n) ; to address > subject > `(("From" . ,from)) ; all other headers > nil nil nil nil) ; don't remember > (insert-buffer-substring (get-buffer buffer)) > (message-goto-body) > (perform-replace marker (nth 0 n) nil nil nil) ; insert name > (message-send-and-exit))) > > Hope that provides food for thought, It does, thanks :) If I understand your code correctly --- and I don=C2=B4t know how to program in elisp (yet) --- your function would load text from some buffer into the composing buffer and replace placeholders with names and emailaddresses supplied as parameters to the function. That way, you could mail an otherwise identical text to a number of recipients with automatically customized salutations. What I=C2=B4m looking for is a little simpler in that I don=C2=B4t need to = use placeholders. It=C2=B4s ok to edit each message manually. I think it might = be possible, as Didier Verna suggested in his reply, to use posting styles and to use a function that just replaces the whole default content of the composing buffer with my template. I=C2=B4ll try to figure out how to get it set up that way; it=C2=B4ll be a = nice excercise. I=C2=B4ll let you guys know what I come up with --- or ask some more questions about how to do it when I get stuck :)