From: Hadron <hadronquark@googlemail.com>
To: info-gnus-english@gnu.org
Subject: fs-change-smtp and draft messages
Date: Tue, 14 Aug 2007 13:19:49 +0200 [thread overview]
Message-ID: <fq4pj2mkh6.fsf@homelinux.net> (raw)
I have a problem with draft messages that I hope someone can help me
with.
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.
,----
| (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)
`----
Despite the draft containing a field
"From: Hadron <hadronquark@googlemail.com>"
the "from" returned by message-fetch-field is another email address from
my address book. It is not getting the "From" field from the draft - or
doesn't appear to be.
This results in the smtp-auth-credentials being set incorrectly.
Any hint/tips on how to correct this?
The strange thing is that the from line above is the one displayed in
the draft edit buffer. It's only when I actually send the message are the
are the wrong smtp credentials used.
next reply other threads:[~2007-08-14 11:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-14 11:19 Hadron [this message]
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
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=fq4pj2mkh6.fsf@homelinux.net \
--to=hadronquark@googlemail.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).