🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nn
Article #1821

Re: Correcting/Augmenting Mail Headers (was: User setting From: address in sendmail input)

#1821
From: 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.
Technical Details
Message-ID: <MIKE-W.91Jul3092627@cs17.cs.aukuni.ac.nz>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.mail.headers.mbox.zip!gmdzi!unido!mcsun!uunet!elroy.jpl.nasa.gov!decwrl!waikato.ac.nz!aukuni.ac.nz!mike-w
References: <FWP1.91Jun19183837@Jester.CC.MsState.Edu><1991Jun20.022606.1680@shaman.com><B ARNETT.91Jun21093917@grymoire.crd.ge.com><6634@trantor.harris-atd.com>

Show Full Headers
Complete Article Headers
Message-ID: <MIKE-W.91Jul3092627@cs17.cs.aukuni.ac.nz>
Subject: Re: Correcting/Augmenting Mail Headers (was: User setting From: address in sendmail input)
Date: Wed, 03 Jul 1991 07:26:27 +0000
From: mike-w@cs.aukuni.ac.nz (Mike Williams)
References: <FWP1.91Jun19183837@Jester.CC.MsState.Edu><1991Jun20.022606.1680@shaman.com><B ARNETT.91Jun21093917@grymoire.crd.ge.com><6634@trantor.harris-atd.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.mail.headers.mbox.zip!gmdzi!unido!mcsun!uunet!elroy.jpl.nasa.gov!decwrl!waikato.ac.nz!aukuni.ac.nz!mike-w
Newsgroups: comp.mail.sendmail,comp.mail,comp.mail.headers,comp.mail.misc,gnu.emacs.help,gnu.emacs.vm.bug,gnu.emacs.vm.info,news.software.nn
Sender: news@ccu1.aukuni.ac.nz (News Owner)
Organization: University of Auckland, New Zealand.
Lines: 58
In-Reply-To: mwills@x102a's message of 29 Jun 91 17:25:02 GMT
Nntp-Posting-Host: cs17.cs.aukuni.ac.nz
X-News-Software: GNUS 3.13