view mail-from-m.el @ 60:77aefd805030

consume pwd on encryption
author Henry S Thompson <ht@inf.ed.ac.uk>
date Fri, 05 Apr 2024 09:11:09 +0100
parents 32a75a4db17b
children c343c57a93e8
line wrap: on
line source

;;; Load to read and send mail from maritain

(setq mail-append-host "home.hst.name")
(setq user-mail-address (format "%s@home.hst.name" user-name))
(setq mail-host-address "home.hst.name")
(defun system-name () "home.hst.name")

(let ((hdn (format "/home/%s" user-name)))
  (let ((sfn (format "%s/.sig.pers" hdn)))
    (setq mail-signature-file sfn
	  message-signature-file sfn
	  mail-signature t
	  message-signature t)
    )
  (setq gnus-default-directory hdn
      gnus-home-directory hdn
      my-mail-dir (format "%s/mail" hdn)
      mail-sources `((file :path ,(format "/var/spool/mail/%s" user-name)))
      mail-archive-file-name (concat my-mail-dir "/cpy/general/"
				     (format-time-string
				      "%Y-%m" (current-time))
				     ".mbox"))
)

(setq mail-archive-file-name (expand-file-name "~/mail/cpy/general"))

;; sending mail on the road
;(setq send-mail-function 'smtpmail-send-it)
;(setq message-send-mail-function 'smtpmail-send-it)
;(setq smtpmail-default-smtp-server "localhost")
;(setq smtpmail-smtp-service "smtp")
;(setq smtpmail-local-domain "home.hst.name")
(setq smtpmail-debug-info t)
(load "smtpmail" nil t)
(setq smtpmail-code-conv-from nil)


(defun quaker-sig-maybe ()
  (save-excursion
    (goto-char (point-min))
    (cond ((to-quaker-p)
	   (goto-char (point-min))
	   (cond ((re-search-forward "^From: .*ht@home.hst.name" nil t)
					;; will fail on mhmcc
		  (backward-char 13)
		  (delete-char 4)
		  (insert "rsof")
		  (goto-char (point-max))
		  (search-backward "\n-- \n")
		  (when (looking-at "\n-- \nHenry")
		    (forward-char 5)
		    (kill-entire-line 5)
		    (insert-file "~/.quaker-sig"))))))))

(defun from-mhmcc ()
  (interactive)
  ;; This is cribbed from the value of
  ;; (gnus-configure-posting-styles "mhmcc-2024")
 (let ((user-full-name "HST as Convenor SESAM MHMC")
       (user-mail-address "mhmcc@rsof.hst.name"))
   (set (make-local-variable (quote user-mail-address))
	"mhmcc@rsof.hst.name")
   (save-excursion
     (message-remove-header "From")
     (message-goto-eoh)
     (insert "From: " (message-make-from) "
")
     ))
 (save-excursion
   (let ((message-signature
	  "Henry S. Thompson, Convenor, SESAM Meeting House Management Committee
"))
     (message-insert-signature)
     (re-search-backward "^--")
     (let ((p (point)))
       (kill-region (re-search-backward "^--") p))
     ))
 (save-excursion
   (message-remove-header "Reply-to")
   (let ((value "sesam.emh.management@gmail.com"))
     (when value
       (message-goto-eoh)
       (insert "Reply-to" ": " value)
       (unless (bolp) (insert "
"))
       ))
   )
 (save-excursion (message-remove-header "Bcc") (let ((value "sesam.emh.management@gmail.com")) (when value (message-goto-eoh) (insert "Bcc" ": " value) (unless (bolp) (insert "
")))))
 )
;   (let ((use-this (gnus-configure-posting-styles "mhmcc-2024"))
; 	(gnus-posting-styles nil))
;   (mapc	(lambda (expr)
; 	  (let ((varbind (and (listp expr)
; 			      (eq (car (caadr expr)) 'save-excursion)
; 			      (caadr (cadr (caddr expr))))))
; 	    (unless (and (eq (car varbind) 'message-signature)
; 			 (not (position "Convenor" (cadr varbind))))
; 	      (apply expr nil))))
; 	 ))

(provide 'mail-from-m)