🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nn
1 messages
1 total messages Started by Mike Williams Wed, 03 Jul 1991 07:26
Re: Correcting/Augmenting Mail Headers (was: User setting From: address in sendmail input)
#1821
Author: Mike Williams
Date: Wed, 03 Jul 1991 07:26
59 lines
3446 bytes
>>> In article <6634@trantor.harris-atd.com>,
>>> "wills" == mwills@x102a (wills ms 01309) writes:

wills> My question is this: How can I enable these features (Reply-to: header
wills> and end-to-end ack) in all my mail, rather than just mail and postings
wills> sent from inside "nn" (e.g. GNU emacs rmail and vm)? 

  Here's a couple of elisp functions which facilitate adding and removing
  mail (or news) headers.  Just stick the appropriate calls in your
  mail-setup-hook, eg.

    | (setq mail-setup-hook 'my-mail-setup-hook)
    | 
    | (defun my-mail-setup-hook ()
    |   (mail-add-header "Return-Receipt-To" my-email-address)
    |   (mail-add-header "Reply-To" my-email-address 'replace)
    |   )

--- Shnip 'ere ------------------------------------------------------------

(require 'mail-utils)

(defun mail-add-header (HEADER CONTENTS &optional REPLACE)
  "Add the specified HEADER to the current mail message, with the given 
CONTENTS.  
If the header already exists, the contents are left unchanged, unless optional 
argument REPLACE is non-nil."
  (save-excursion
    (let ((header-exists (mail-position-on-field HEADER)))
      ;; Delete old contents if REPLACE is set
      (if (and header-exists REPLACE)
	  (let ((end (point))
		(beg (progn
		       (re-search-backward (concat HEADER ": "))
		       (goto-char (match-end 0)))))
	    (delete-region beg end)))
      ;; Add new contents if REPLACE is set, or this is a new header.
      (if (or (not header-exists) REPLACE)
	  (progn (insert CONTENTS) CONTENTS)))))

(defun mail-remove-header (HEADER)
  "Remove the specified HEADER from the current mail message."
  (save-excursion
    (if (mail-position-on-field HEADER 'soft)
	(let ((end (point))
	      (beg (progn
		     (re-search-backward (concat HEADER ": "))
		     (goto-char (match-beginning 0)))))
	  (delete-region beg (1+ end))))))
    
--
    /-------------------- mike-w@cs.aukuni.ac.nz ---------------------\
    | Mike Williams, Computer Science, Auckland University, Aotearoa. |
    \-------------- I have a lovely bunch of coconuts. ---------------/
    Disclaimer: I wasn't even there.
-- 
New administrater uofa.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads