unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tassilo Horn <heimdall@uni-koblenz.de>
Subject: Elisp help needed
Date: Wed, 26 Nov 2003 23:59:10 +0100	[thread overview]
Message-ID: <871xru20u9.fsf@inspiron.meinnetz.de> (raw)

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

             reply	other threads:[~2003-11-26 22:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-26 22:59 Tassilo Horn [this message]
2003-11-27  6:29 ` Elisp help needed Eli Zaretskii
     [not found] ` <mailman.693.1069918173.399.help-gnu-emacs@gnu.org>
2003-11-27  8:48   ` Tassilo Horn
  -- strict thread matches above, loose matches on Subject: below --
2006-03-01 16:58 elisp " Robert D. Crawford
2006-03-01 21:37 ` RD
2006-03-02 11:36   ` Robert D. Crawford
2006-03-04 12:26     ` Tim Cross
2006-03-04 13:57       ` Robert D. Crawford
2006-03-02 12:50 ` Katsumi Yamaoka
2006-03-02 13:34   ` Robert D. Crawford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871xru20u9.fsf@inspiron.meinnetz.de \
    --to=heimdall@uni-koblenz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).