From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/46658 Path: main.gmane.org!not-for-mail From: "Patrick J. LoPresti" Newsgroups: gmane.emacs.gnus.general Subject: Re: smtpmail: MAIL FROM and `gnus-posting-styles' Date: 23 Sep 2002 15:20:45 -0400 Sender: owner-ding@hpc.uh.edu Message-ID: References: <874rcprohi.fsf@ID-56226.news.dfncis.de> <87r8fq18bs.fsf@ID-56226.news.dfncis.de> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1032809020 27829 127.0.0.1 (23 Sep 2002 19:23:40 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 23 Sep 2002 19:23:40 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17tYny-0007Ea-00 for ; Mon, 23 Sep 2002 21:23:39 +0200 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 17tYmC-0000vP-00; Mon, 23 Sep 2002 14:21:48 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 23 Sep 2002 14:22:26 -0500 (CDT) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id OAA08980 for ; Mon, 23 Sep 2002 14:22:15 -0500 (CDT) Original-Received: (qmail 2374 invoked by alias); 23 Sep 2002 19:21:23 -0000 Original-Received: (qmail 2369 invoked from network); 23 Sep 2002 19:21:23 -0000 Original-Received: from lockupnat.curl.com (HELO egghead.curl.com) (216.230.83.254) by gnus.org with SMTP; 23 Sep 2002 19:21:23 -0000 Original-Received: by egghead.curl.com (Postfix, from userid 10171) id 231A77323; Mon, 23 Sep 2002 15:20:46 -0400 (EDT) Original-To: ding@gnus.org In-Reply-To: Original-Lines: 38 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:46658 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:46658 Micha Wiedenmann writes: > AFAICS it is not possible to set buffer-local variables from > `gnus-posting-styles' but I would need buffer-local > `user-mail-addresses' since I use several addresses. Below is the hack I use to set user-mail-address from the From header dynamically. Some broken software insists on using the envelope sender (or Sender header) for replies, so I find it pays to forge everything if you are going to forge anything. It should be pretty easy to adapt this code for other sending methods. (For qmail, you may need to add "-f " to the qmail-inject line, for instance.) - Pat (defun patl-send-mail-function () ;; Save and restore user-mail-address (let ((user-mail-address user-mail-address)) (message-send-mail-with-sendmail))) (setq message-send-mail-function 'patl-send-mail-function) (add-hook 'message-send-mail-hook (function (lambda () (goto-char (point-min)) (let ((from-header (mail-header 'from (mail-header-extract))) from) (if (stringp from-header) (setq from (car-safe (cdr-safe (mail-extract-address-components from-header))))) (if from (setq user-mail-address from))))))