From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/5650 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.gnus.user Subject: Re: [Gnus] `From' according to `Envelope-to'. Date: Tue, 06 Sep 2005 20:31:54 +0200 Organization: Dept. of Theoretical Physics, University of Ulm Message-ID: References: Reply-To: Reiner Steib NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1138671341 28314 80.91.229.2 (31 Jan 2006 01:35:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 31 Jan 2006 01:35:41 +0000 (UTC) Original-X-From: nobody Tue Jan 17 17:35:37 2006 Original-Newsgroups: gnu.emacs.help,gnu.emacs.gnus Original-Followup-To: gnu.emacs.gnus X-Face: /U7=m^"/-Dn61mAl{g9e3>\G5Tp,oEX|V)g2I1hBk\ML;)7A?6cmB-y7y?'NA^J<=oz7syB =(McAwIHgLX!.B?R3X}98d@?>CrT094KLWh]WU4gDpnL/")MS(XoQTv`Oq225uL>+;CpPXo$N5e>N> $tPd-gbB^F{gQS#1ase]XO~D4p4M"3+F-7~u]dy3I?Pb8RO*H-EFeWDUf?Rf,d]pv\Jvh2Cht!A=im yKAS2Z%Ao^;}W/qzMvMm Mail-Copies-To: nobody User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:YebIkr7P4ZFZWglLPZfZCagFuw4= Original-NNTP-Posting-Host: bridgekeeper.physik.uni-ulm.de Original-X-Trace: news.uni-ulm.de 1126031527 134.60.10.123 (6 Sep 2005 20:32:07 +0200) Original-Path: quimby.gnus.org!newsfeed.gazeta.pl!news.nask.pl!newsfeed.pionier.net.pl!news-fra1.dfn.de!news-lei1.dfn.de!newsfeed00.sul.t-online.de!t-online.de!inka.de!rz.uni-karlsruhe.de!news.uni-ulm.de!bridgekeeper.physik.uni-ulm.de!not-for-mail Original-Xref: bridgekeeper.physik.uni-ulm.de gnus-emacs-gnus:5792 Original-Lines: 77 X-Gnus-Article-Number: 5792 Tue Jan 17 17:35:37 2006 Xref: news.gmane.org gmane.emacs.gnus.user:5650 Archived-At: On Tue, Sep 06 2005, Michael Cadilhac wrote: [ Crosspost & Followup-To: gnu.emacs.gnus ] > As I've multiple aliases for the same mailbox, I receive mail sent > to different addresses (mentioned in the `envelope-to' field of the > received messages). > > In order to not disturb the sender, I want - when replying - to be > warned like : > > ``Your default "from" field is `michael.cadilhac@lrde.org', but the > sender used `mc@lrde.epita.fr'. Change ?'' I use the following code to check the "To" header. After changing (message-fetch-field "to") to (message-fetch-field "envelope-to") it might do what you want. You also need to set `rs-message-to-from-addresses' or `gnus-ignored-from-addresses'. --8<---------------cut here---------------start------------->8--- (defvar rs-message-to-from-addresses gnus-ignored-from-addresses "Regexp matching To headers. When using entries like ((message-mail-p) (address (rs-message-to-from-address))) or ((message-mail-p) (address (rs-message-to-from-address \"foo@example.invalid\"))) in `gnus-posting-styles', the address in the From header is taken from the To header of the article you are replying to.") ;;;###autoload (defun rs-message-to-from-address (&optional fallback) "Return a suitable address. See `rs-message-to-from-addresses' for more." (let ((to (and (boundp 'gnus-article-buffer) (gnus-buffer-live-p gnus-article-buffer) ;; `gnus-buffer-live-p' already returns ;; `gnus-article-buffer', but it's not documented. So ;; let's be careful. gnus-article-buffer (with-current-buffer gnus-article-buffer (message-fetch-field "to"))))) (cond ((and to (not (string-match "," to));; FIXME (string-match rs-message-to-from-addresses to)) (let ((from (cadr (mail-extract-address-components to)))) ;; gnus-extract-address-components fails for dit Outlook stuff! (if (and (string-match rs-message-to-from-addresses from) (string-match (concat "^" (if (boundp 'gnus-button-valid-localpart-regexp) gnus-button-valid-localpart-regexp "[a-z0-9-_+.]+") "@" message-valid-fqdn-regexp "$") from)) from (if (y-or-n-p (format "Address <%s> might be bogus. Use anyway? " from)) from)))) (fallback fallback) (t user-mail-address)))) --8<---------------cut here---------------end--------------->8--- Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/