[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help needed to simplify code for customisation
From: |
Richard Riley |
Subject: |
Re: Help needed to simplify code for customisation |
Date: |
Tue, 10 Mar 2009 13:25:00 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux) |
Many thanks for all the replies. Andy Stewart emailed me what I consider
the easiest (for me!) to customise, follow and understand:
,----
| (defvar msmtp-name-list '("root" "richardriley" "rileyrgdev" "riley" "sham"))
|
| (defun msmtp-change-smtp ()
|
| (setq sendmail-program "/usr/bin/msmtp")
| (setq smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil)))
| (setq smtpmail-smtp-server "smtp.gmail.com")
| (setq message-sendmail-envelope-from 'header)
|
| (if (message-mail-p)
| (save-excursion
| (let* ((from
| (save-restriction
| (message-narrow-to-headers)
| (message-fetch-field "from")))
| (account (catch 'match
| (dolist (element msmtp-name-list)
| (when (string-match (format ".*%s.*" element) from)
| (throw 'match element))))))
| (setq message-sendmail-extra-arguments (list "-a" account))
| ))))
|
| (add-hook 'message-send-hook 'msmtp-change-smtp)
`----
And adding a new match element and associated posting style for another
msmtp account in a, possibly, readonly, include is as simple as (using
"name" as match):
,----
| (add-to-list 'msmtp-name-list "name" t)
`----
along with the appropriate posting style:
,----
| (add-to-list `gnus-posting-styles `(
| ,(rx(or "groupname"))
| (name "name")
| (from "name <name-email>")
| (face nil)
| (x-face-file nil)
| (eval(setq gnushush-user-agent-header (quote real)))
| (eval (setq pgg-gpg-user-id nil))
| (signature-file nil)) t )
`----
Thanks again to all.
r.
--
important and urgent problems of the technology of today are no longer the
satisfactions of the primary needs or of archetypal wishes, but the reparation
of the evils and damages by the technology of yesterday. ~Dennis Gabor,
Innovations: Scientific, Technological and Social, 1970
Re: Help needed to simplify code for customisation, Kevin Rodgers, 2009/03/10