[comp.emacs] How to add a mail header field via .emacs

jbw@BIGBIRD.BU.EDU (Joe Wells) (12/20/90)

   I'd like to add "Return-Receipt-To: " header field to my mail template. Can
   I do this in my .emacs (I already know about CC, BCC, etc.)? If so, please 
   *mail* me the lisp code for it. Thank you.

Well, of course you can always simply type in any headers you want.  But
if you want to define a command to do the work for you, it goes roughly
like this:

    (defun mail-return-receipt-to ()
      "Move point to end of Return-Receipt-To-field.  Create a
    Return-Receipt-To field if none.  Then add the user's login name." 
      (interactive)
      (expand-abbrev)
      (save-excursion
	(or (mail-position-on-field "Return-Receipt-To" t)
	    (progn (mail-position-on-field "to")
		   (insert "\nReturn-Receipt-To: ")))
	(or (eq ?  (preceding-char)) (insert ", "))
	(insert (user-login-name))))

    (define-key mail-mode-map "\C-c\C-f\C-r" 'mail-return-receipt-to)

-- 
Enjoy,

Joe

dowlati%mips2.cr.bull.com@NIC.NEAR.NET (Saadat Dowlati) (12/21/90)

Hi Joe,
	Thanks for the code. I was doing it manually until now. I have been
meaning to learn lisp but never found the time. What I really had in mind 
was the static version of what you sent me, i.e., define a variable, say
" mail-return-receipt-to", and then:

   (setq mail-return-receipt-to "foo@foo.com")

Good luck with your Ph.D. program.
--
sd