[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fs-change-smtp and draft messages
From: |
Hadron |
Subject: |
Re: fs-change-smtp and draft messages |
Date: |
Tue, 14 Aug 2007 15:54:25 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux) |
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
--