On Fri, Nov 17 2006, Brep wrote:
> ssSslang <[EMAIL PROTECTED]> writes:
>
>> Thank you, Reiner. I saw these hooks, but they're not related to mail
>> address. Do you mean I should write a function to select the encoding
>> according to the From header, and then bind it to the hook?
>
> Try this:
>
> (add-hook 'message-send-hook 'change-charset)
> (defun change-charset ()
> (when (message-mail-p)
> (if (string-match "hotmail" (mail-fetch-field "to"))
> (setq mm-coding-system-priorities
> '(iso-8859-1 gbk utf-8))
> (setq mm-coding-system-priorities
> '(iso-8859-1 utf-8)))))
I'd suggest something like this (barely tested):
--8<---------------cut here---------------start------------->8---
(setq sssslang-message-change-charset-regexp "@hotmail\\.com\\>")
(setq mm-coding-system-priorities '(iso-8859-1 utf-8)))))
(add-hook 'message-send-mail-hook 'sssslang-message-change-charset)
(defun sssslang-message-change-charset ()
(save-restriction
(message-narrow-to-headers)
(when (or (string-match sssslang-message-change-charset-regexp
(or (message-fetch-field "to") ""))
(string-match sssslang-message-change-charset-regexp
(or (message-fetch-field "cc") ""))
(string-match sssslang-message-change-charset-regexp
(or (message-fetch-field "bcc") "")))
(set (make-local-variable 'mm-coding-system-priorities)
'(iso-8859-1 gbk utf-8)))))
--8<---------------cut here---------------end--------------->8---
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
_______________________________________________
info-gnus-english mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/info-gnus-english