* Checking attachments are actually attached
@ 2006-04-08 10:34 François Fleuret
0 siblings, 0 replies; only message in thread
From: François Fleuret @ 2006-04-08 10:34 UTC (permalink / raw)
Dear all,
I wrote this, which may be of interest for others:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Checks that the mail contains an attached file if the body refers
;; to such an attachment. The idea comes from
;; http://home.cc.gatech.edu/eaganj/MailApp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defcustom check-no-missing-attachment-regexp "attach"
"*A mail whose body matches this regular expression should contain
an attachment")
(defun contains-attachment (l)
(and l (or (and
(eq (car (car l)) 'part)
(string= "attachment" (cdr (assoc 'disposition (cdr (car l))))))
(contains-attachment (cdr l)))))
(defun check-no-missing-attachment ()
"Checks the mail contains an attached file if the body refers to such an attachment"
(message-goto-body)
(and (re-search-forward check-no-missing-attachment-regexp nil t)
(not (contains-attachment (mml-parse)))
(not (y-or-n-p "An attachment seems to be missing, send message ? "))
(error "You refer to an unexisting attachment.")))
(add-hook 'message-send-hook 'check-no-missing-attachment)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Comments are of course welcome.
Cheers,
--
François Fleuret http://cvlab.epfl.ch/~fleuret
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-04-08 10:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-08 10:34 Checking attachments are actually attached François Fleuret
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).