Gnus development mailing list
 help / color / mirror / Atom feed
From: lee <lee@yun.yagibdah.de>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: ding@gnus.org
Subject: Re: using templates to write articles (email)
Date: Fri, 10 Jun 2011 22:41:55 +0200	[thread overview]
Message-ID: <8762od179s.fsf@yun.yagibdah.de> (raw)
In-Reply-To: <87ei318qmy.fsf@ericabrahamsen.net>

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> lee <lee@yun.yagibdah.de> writes:
>
>> So far, I´ve created templates as plain text files, and when writing 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´s some support for templates already built in, which
>> 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: \nsSubject: \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´t
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´m looking for is a little simpler in that I don´t need to use
placeholders. It´s 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´ll try to figure out how to get it set up that way; it´ll be a nice
excercise. I´ll let you guys know what I come up with --- or ask some
more questions about how to do it when I get stuck :)



  reply	other threads:[~2011-06-10 20:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-10 18:03 lee
2011-06-10 18:53 ` Eric Abrahamsen
2011-06-10 20:41   ` lee [this message]
2011-06-10 19:32 ` Didier Verna
2011-06-10 20:46   ` lee
2011-06-11 17:22 ` Dan Christensen
2011-06-13  0:33 ` solved: " lee

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

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

  git send-email \
    --in-reply-to=8762od179s.fsf@yun.yagibdah.de \
    --to=lee@yun.yagibdah.de \
    --cc=ding@gnus.org \
    --cc=eric@ericabrahamsen.net \
    /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.
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 NNTP newsgroup(s).