help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Elisp help needed


From: Tassilo Horn
Subject: Elisp help needed
Date: Wed, 26 Nov 2003 23:59:10 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

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 "address@hidden")
        (setq smtpmail-smtp-server "mailhost.uni-koblenz.de"))
       ((string-match from "address@hidden")
        (setq smtpmail-smtp-server "mx.freenet.de"))
       ((string-match from "address@hidden")
        (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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]