[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: changing smtp server?
From: |
Tassilo Horn |
Subject: |
Re: changing smtp server? |
Date: |
Fri, 10 Aug 2007 21:37:50 +0200 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) |
someusernamehere <someusernamehere@gmail.com> writes:
> (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"))))
> (message "From is `%s', setting `smtpmail-smtp-server' to `%s'"
> from
> (cond
> ((string-match "f...@bar.org" from)
> ;; Use stmp-auth
> (message "Using smtp-auth")
> ;; Sending mail
> ((....................
> ....................))
> ((string-match "f...@bar2.org" from)
> ;; Use other server
> (message "Using other server")
> ((.......................
> .......................))
> (t
> (error
> (concat "Don't know which mail server to use for
> "
> from))))))))
>
> (add-hook 'message-setup-hook 'fs-change-smtp)
>
> For change among smtp servers depending the "from" header, but.....
> what abou when I want to send News????, I want to send news with the
> from fuck-s...@foo.com, but this is not defined in the function fs-
> change-smtp then I get an "Don't know which mail server to use for ",
>
> how I can fix this?
Replace the `error' in the function above with `message'. Then the
"Dont't know..." message will still be printed, but no erros will be
signalled. That's ok because for news you don't use smtp servers
anyway.
Oh, wait. There's a better solution. Take the function as-is, but add
it to `message-send-mail-hook' instead of `message-setup-hook'.
Bye,
Tassilo
--
My work on free software is motivated by an idealistic goal: spreading
freedom and cooperation. I want to encourage free software to spread,
replacing proprietary software that forbids cooperation, and thus make
our society better. (Richard M. Stallman)