From: Tassilo Horn <tassilo@member.fsf.org>
To: info-gnus-english@gnu.org
Subject: Re: changing smtp server?
Date: Fri, 10 Aug 2007 21:37:50 +0200 [thread overview]
Message-ID: <87vebnb2pd.fsf@baldur.tsdh.de> (raw)
In-Reply-To: <1186770147.837979.152700@x35g2000prf.googlegroups.com>
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)
next prev parent reply other threads:[~2007-08-10 19:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-10 17:31 someusernamehere
2007-08-10 17:54 ` Adam Sjøgren
2007-08-10 17:59 ` someusernamehere
2007-08-10 18:06 ` Adam Sjøgren
2007-08-10 18:22 ` someusernamehere
2007-08-10 19:02 ` Adam Sjøgren
2007-08-10 19:37 ` Tassilo Horn [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-08-10 17:28 someusernamehere
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vebnb2pd.fsf@baldur.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=info-gnus-english@gnu.org \
/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 NNTP newsgroup(s).