Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Slackrat <s4Qlackrat@azurservers.com>
To: info-gnus-english@gnu.org
Subject: Re: fs-change-smtp and draft messages
Date: Tue, 14 Aug 2007 17:28:27 +0200	[thread overview]
Message-ID: <87lkcerv8k.fsf@azurservers.com> (raw)
In-Reply-To: <l48x8ete5q.fsf@googlemail.com>

Hadron <hadronquark@googlemail.com> writes:

> Tassilo Horn <tassilo@member.fsf.org> writes:
>
>> Hadron <hadronquark@googlemail.com> writes:
>>
>> Hi Hadron,
>>
>>> If I save a message to drafts and then edit it at a later date (press
>>> "e" - calls function gnus-draft-edit-message) then the call to the
>>> hook fs-change-smtp doesn't respect the existing "from" field in the
>>> draft.
>>
>> Sure, because the message buffer doesn't neet to be setup then.  You
>> added `fs-change-smtp' to `message-setup-hook', whereas
>> `message-send-hook' would be much more appropriate.
>
> Ye gods. That must have been some careless global changes I made.
>
> The question remains though and possibly you could explain it to me (I
> cant follow the lisp), why is message setup hook being called for
> editing a draft, and even though it is (was) why is it not picking up
> the existing "From" field that is there in the draft?
>
>>
>>> ,----
>>> | (defun fs-change-smtp ()
>>> |   "Change the SMTP server according to the current from line."
>>> |   (setq smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil)))
>>> |   (setq message-send-mail-function 'smtpmail-send-it)
>>> |   (save-excursion
>>> |     (let ((from
>>> |            (save-restriction
>>> |              (message-narrow-to-headers)
>>> |              (message-fetch-field "from"))))
>>> |       (message "%s" from)
>>> |       (message "**** From is `%s', setting `smtpmail-smtp-server' to `%s'"
>>> |                from
>>> |                (cond
>>> | 		((string-match ".*adron.*" from)
>>> |  		 (setq smtpmail-auth-credentials '(("smtp.gmail.com" 587 "hadronquark" "*******"))))
>>> |                 ((string-match ".*default.*" from)
>>> | 		 (setq smtpmail-auth-credentials '(("smtp.gmail.com" 587 "otheremails" "********"))))
>>> | 		(t
>>> | 		 (setq smtpmail-auth-credentials '(("smtp.gmail.com" 587 "default" "********")))
>>> |                )))))
>>> | )
>>> | 
>>> | (add-hook 'message-setup-hook 'fs-change-smtp)
>>> `----
>>
>> Bye,
>> Tassilo
>
> -- 
TEST IGNORE

-- 
SlackRat - No 4Q to Reply

  reply	other threads:[~2007-08-14 15:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-14 11:19 Hadron
2007-08-14 13:24 ` Tassilo Horn
     [not found] ` <mailman.4764.1187097864.32220.info-gnus-english@gnu.org>
2007-08-14 13:54   ` Hadron
2007-08-14 15:28     ` Slackrat [this message]
2007-08-14 15:14   ` Hadron
2007-08-14 15:39     ` Slackrat
2007-08-14 16:39     ` Tassilo Horn
2007-08-14 17:22       ` Leo
2007-08-14 18:39         ` Tassilo Horn
     [not found]     ` <mailman.4771.1187109611.32220.info-gnus-english@gnu.org>
2007-08-15  9:58       ` Hadron

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=87lkcerv8k.fsf@azurservers.com \
    --to=s4qlackrat@azurservers.com \
    --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).