• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/gnus/

Lines Matching +defs:mail +defs:header +defs:id

1 ;;; nnmail.el --- mail support functions for the Gnus mail backends
7 ;; Keywords: news, mail
37 (require 'mail-source)
45 "Reading mail with Gnus."
49 "Retrieving new mail."
53 "Preparing (or mangling) new mail after retrieval."
57 "Handling of duplicate mail messages."
61 "Organizing the incoming mail in folders."
70 "Expiring old mail."
74 "Interfacing with procmail and other mail agents."
78 "Various mail options."
81 (defcustom nnmail-split-methods '(("mail.misc" ""))
82 "*Incoming mail will be split according to this variable.
84 If you'd like, for instance, one mail group for mail from the
85 \"4ad-l\" mailing list, one group for junk mail and one for everything
89 '((\"mail.4ad\" \"From:.*4ad\")
90 (\"mail.junk\" \"From:.*Lars\\\\|Subject:.*buy\")
91 (\"mail.misc\" \"\")))
95 does not have to be called anything beginning with \"mail\",
97 nnmail will try to match on the header to find a fit.
102 mail belongs in that group.
115 "If non-nil, do crossposting if several split methods match the mail.
144 new mail into folder numbers that Gnus has marked as expired."
150 "If non-nil the mail backends will use long file and directory names.
151 If nil, groups like \"mail.misc\" will end up in directories like
152 \"mail/misc/\"."
157 "Set the mode bits of all new mail files to this integer."
212 time extracted from the articles' Date header (if missing the current
216 will try to match against both the From and the To header.
226 From header will be expired to the group \"nnfolder:Work\";
227 articles containing the sting \"IMPORTANT\" in the Subject header will
245 "*Where the mail backends will look for incoming mail.
246 This variable is a list of mail source specifiers.
247 This variable is obsolete; `mail-sources' should be used instead."
252 Use `mail-sources' instead.")
256 "*If non-nil, re-split incoming procmail sorted mail."
260 (defcustom nnmail-scan-directory-mail-source-once nil
268 "Function called to delete files in some mail backends."
289 "*Hook that will be run after the incoming mail has been transferred.
290 The incoming mail is moved from the specified spool file (which normally is
291 something like \"/usr/spool/mail/$user\") to the user's home
292 directory. This hook is called after the incoming mail box has been
293 emptied, and can be used to call any mail box programs you have
303 If you have xwatch running, this will alert it that mail has been
311 ;; the flag that says you have mail.
318 "Hook called before treating incoming mail.
319 The hook is run in a buffer with all the new, incoming mail."
323 (defcustom nnmail-prepare-incoming-header-hook nil
343 (defcustom nnmail-pre-get-new-mail-hook nil
344 "Hook called just before starting to handle new incoming mail."
348 (defcustom nnmail-post-get-new-mail-hook nil
349 "Hook called just after finishing handling new incoming mail."
430 (symbol :value mail))
437 (const :tag "Junk (delete mail)" junk)))
439 (defcustom nnmail-split-fancy "mail.misc"
440 "Incoming mail can be split according to this fancy variable.
456 A SPLIT expression is said to match if it will cause the mail
492 '(| (\"from\" mail (| (\"subject\" \"warn.*\" \"mail.warning\")
493 \"mail.misc\"))
496 ;; (ding) list and the group for other (ding) related mail.
511 ;; Unmatched mail goes to the catch all group.
518 (mail . "mailer-daemon\\|postmaster\\|uucp")
527 (defcustom nnmail-message-id-cache-length 1000
535 (defcustom nnmail-message-id-cache-file "~/.nnmail-cache"
542 "*If non-nil, nnmail keep a cache of Message-IDs to discover mail duplicates.
562 (defcustom nnmail-split-header-length-limit 2048
568 (defcustom nnmail-mail-splitting-charset nil
569 "Default charset to be used when splitting incoming mail."
574 (defcustom nnmail-mail-splitting-decodes nil
613 (defvar nnmail-prepare-save-mail-hook nil
614 "Hook called before saving mail.")
623 (mail-send-and-exit nil))
730 (mail-source-bind (directory source)
736 (defun nnmail-process-babyl-mail-format (func artnum-func)
739 start message-id content-length do-search end)
760 (run-hooks 'nnmail-prepare-incoming-header-hook)
762 ;; Find the Message-ID header.
766 (setq message-id (buffer-substring (match-beginning 1)
774 (insert "Message-ID: " (setq message-id (nnmail-message-id))
776 ;; Look for a Content-Length header.
784 ;; We destroy the header, since none of
787 ;; a (possibly) faulty header.
811 (nnmail-check-duplication message-id func artnum-func)
817 (defsubst nnmail-search-unix-mail-delim ()
824 ;; line is blank and the next line looks like a header.
825 ;; Then it's possible that this is a mail delim, and we use it.
846 (defun nnmail-search-unix-mail-delim-backward ()
853 ;; line is blank and the next line looks like a header.
854 ;; Then it's possible that this is a mail delim, and we use it.
875 (defun nnmail-process-unix-mail-format (func artnum-func)
878 start message-id content-length end skip head-end)
883 (error "Error, unknown mail format! (Possibly corrupted %s `%s'.)"
901 ;; Find the Message-ID header.
904 (setq message-id (match-string 1))
911 (insert "Message-ID: " (setq message-id (nnmail-message-id)) "\n"))
912 ;; Look for a Content-Length header.
918 ;; We destroy the header, since none of the backends ever
920 ;; having a (possibly) faulty header.
923 (run-hooks 'nnmail-prepare-incoming-header-hook)
928 ;; We try the Content-Length value. The idea: skip over the header
933 ;; three is met, the content-length header is probably invalid.
951 (or (nnmail-search-unix-mail-delim)
959 (nnmail-check-duplication message-id func artnum-func)
964 (defun nnmail-process-mmdf-mail-format (func artnum-func)
968 start message-id end)
973 (error "Error, unknown mail format! (Possibly corrupted.)")
988 ;; Find the Message-ID header.
991 (setq message-id (match-string 1))
998 (insert "Message-ID: " (setq message-id (nnmail-message-id)) "\n"))
999 (run-hooks 'nnmail-prepare-incoming-header-hook)
1012 (nnmail-check-duplication message-id func artnum-func)
1018 (defun nnmail-process-maildir-mail-format (func artnum-func)
1019 ;; In a maildir, every file contains exactly one mail.
1021 message-id)
1034 ;; Find the Message-ID header.
1037 (setq message-id (match-string 1))
1044 (insert "Message-ID: " (setq message-id (nnmail-message-id)) "\n"))
1045 (run-hooks 'nnmail-prepare-incoming-header-hook)
1050 (nnmail-check-duplication message-id func artnum-func))
1055 "Go through the entire INCOMING file and pick out each individual mail.
1056 FUNC will be called with the buffer narrowed to each mail."
1074 ;; Handle both babyl, MMDF and unix mail formats, since
1079 (nnmail-process-babyl-mail-format func artnum-func))
1081 (nnmail-process-mmdf-mail-format func artnum-func))
1083 (nnmail-process-maildir-mail-format func artnum-func))
1085 (nnmail-process-unix-mail-format func artnum-func))))
1116 (when nnmail-mail-splitting-decodes
1117 (let ((mail-parse-charset nnmail-mail-splitting-charset))
1118 (mail-decode-encoded-word-region (point-min) (point-max))))
1129 (unless (< (move-to-column nnmail-split-header-length-limit)
1130 nnmail-split-header-length-limit)
1149 5 "Error in `nnmail-split-methods'; using `bogus' mail group: %S" error-info)
1222 "Insert how many lines there are in the body of the mail.
1303 (custom-add-option 'nnmail-prepare-incoming-header-hook
1314 (message-tokenize-header
1400 ;; beginning of the value, whereas after-header-name
1403 (after-header-name (match-end 2)))
1409 ;; RESTRICT must start after-header-name and
1413 ;; the header is: ``To: x-foo, foo''
1416 after-header-name t)
1543 (defun nnmail-message-id ()
1544 (concat "<" (message-unique-id) "@totally-fudged-out-message-id>"))
1560 (get-buffer-create " *nnmail message-id cache*")))
1562 (when (file-exists-p nnmail-message-id-cache-file)
1563 (nnheader-insert-file-contents nnmail-message-id-cache-file))
1576 (when (search-backward "\n" nil t nnmail-message-id-cache-length)
1581 (or (file-exists-p (file-name-directory nnmail-message-id-cache-file))
1582 (make-directory (file-name-directory nnmail-message-id-cache-file)
1585 nnmail-message-id-cache-file nil 'silent)
1594 (defun nnmail-cache-insert (id grp &optional subject sender)
1595 (when (stringp id)
1599 id grp subject sender))
1613 (nnmail-cache-primary-mail-backend)))
1619 (insert id "\t" grp "\n")))
1620 (insert id "\n"))))))
1622 (defun nnmail-cache-primary-mail-backend ()
1626 (get-new-mail nil))
1631 (setq get-new-mail
1632 (intern (format "%s-get-new-mail" (car be))))
1633 (boundp get-new-mail)
1634 (symbol-value get-new-mail))
1638 ;; Fetch the group name corresponding to the message id stored in the
1640 (defun nnmail-cache-fetch-group (id)
1645 (when (search-backward id nil t)
1659 References or In-Reply-To header and then looks in the message id
1660 cache file (given by the variable `nnmail-message-id-cache-file') to
1686 (defun nnmail-cache-id-exists-p (id)
1691 (search-backward id nil t))))
1693 (defun nnmail-fetch-field (header)
1697 (message-fetch-field header))))
1699 (defun nnmail-check-duplication (message-id func artnum-func)
1702 (let* ((duplication (nnmail-cache-id-exists-p message-id))
1709 (funcall nnmail-treat-duplicates message-id))
1713 ;; We insert a line that says what the mail source is.
1716 (re-search-forward "^message-id[ \t]*:" nil t)
1718 (insert (format "X-Gnus-Mail-Source: %s\n" mail-source-string)))
1725 (nnmail-cache-insert message-id (caar group-art)))
1732 (re-search-forward "^message-id[ \t]*:" nil t)
1735 "Gnus-Warning: This is a duplicate of message " message-id "\n")
1746 ;;; Get new mail.
1755 (defun nnmail-get-new-mail (method exit-func temp
1757 "Read new incoming mail."
1758 (let* ((sources (or mail-sources
1768 (when (and (nnmail-get-value "%s-get-new-mail" method)
1787 (null nnmail-scan-directory-mail-source-once)
1789 (mail-source-bind (directory source)
1807 (run-hooks 'nnmail-pre-get-new-mail-hook)
1808 ;; Open the message-id cache.
1810 ;; The we go through all the existing mail source specification
1811 ;; and fetch the mail from each.
1813 (nnheader-message 4 "%s: Reading incoming mail from %s..."
1816 (mail-source-fetch
1821 file ',(intern (format "%s-save-mail" method))
1831 (nnheader-message 4 "%s: Reading incoming mail (no new mail)...done"
1839 (nnheader-message 4 "%s: Reading incoming mail (%d new)...done" method
1841 ;; Close the message-id cache.
1844 (run-hooks 'nnmail-post-get-new-mail-hook))))
1886 (let* (header
1900 (setq header (car regexp-target-pair))
1902 ;; If the header is to-from then match against the
1903 ;; To or From header
1904 ((and (equal header 'to-from)
1909 ((and (not (equal header 'to-from))
1912 (message-fetch-field header)
1923 (insert "Message-ID: " (nnmail-message-id) "\n")))))
1944 (message-remove-header "status")
1992 "Generate an overview of where the last mail split put articles."
2017 (defun nnmail-new-mail-p (group)
2018 "Say whether GROUP has new mail."
2028 "Check to see if point is within the headers of a unix mail message.
2032 (and (nnmail-search-unix-mail-delim-backward)