From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Elisp help needed Date: Wed, 26 Nov 2003 23:59:10 +0100 Organization: University Koblenz / CC Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <871xru20u9.fsf@inspiron.meinnetz.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1069888608 673 80.91.224.253 (26 Nov 2003 23:16:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 26 Nov 2003 23:16:48 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 27 00:16:46 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AP8tq-0007Lo-00 for ; Thu, 27 Nov 2003 00:16:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AP9qX-000112-2r for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Nov 2003 19:17:25 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-fra1.dfn.de!news.uni-koblenz.de!inspiron.meinnetz.de!news Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-NNTP-Posting-Host: pd9eaec15.dip.t-dialin.net Original-X-Trace: news.uni-koblenz.de 1069887561 13056 217.234.236.21 (26 Nov 2003 22:59:21 GMT) Original-X-Complaints-To: usenet@news.uni-koblenz.de Original-NNTP-Posting-Date: 26 Nov 2003 22:59:21 GMT User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:Z7g7sNX285sFe7B8znu8eJiT1p8= Original-Xref: shelby.stanford.edu gnu.emacs.help:118686 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:14628 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:14628 Hi, I need some help with Elisp. I want to configure Gnus to my needs and therefore wrote an Elisp function which should fetch the From-line of mails I wanna send. With the From-line it should decide which smtp-server the mail should be send through. My code is: (defun fs-change-smtp () "Change the SMTP server according to the current from line." (save-excursion (let ((from (save-restriction (message-narrow-to-headers) (message-fetch-field "from")))) (cond ((string-match from "heimdall@uni-koblenz.de") (setq smtpmail-smtp-server "mailhost.uni-koblenz.de")) ((string-match from "tassilo.horn@freenet.de") (setq smtpmail-smtp-server "mx.freenet.de")) ((string-match from "tassilo.horn@gmx.de") (setq smtpmail-smtp-server "mail.gmx.de")) (t (setq smtpmail-smtp-server "mailhost.uni-koblenz.de")))))) (add-hook 'message-send-hook 'fs-change-smtp) But this doesn't work correctly. Always the default of the cond is taken, even the From-line is another mail address (gmx or freenet). So I think that the variable from has the wrong content. Does anybody find the bug? Or does anyone have another solution for my problem? Much thanks in advance, Tassilo -- "I dunno - the guy who wrote the mouse driver in Windows systems was a genius. Ever noticed that the mouse can still work when the whole OS has crashed in a screaming heap?" - John Wiltshire