Variable: nnmail-read-incoming-hook

nnmail-read-incoming-hook is a customizable variable defined in nnmail.el.gz.

Value

nil

Documentation

Hook that will be run after the incoming mail has been transferred.

The incoming mail is moved from the specified spool file (which normally is something like "/usr/spool/mail/$user") to the user's home directory. This hook is called after the incoming mail box has been emptied, and can be used to call any mail box programs you have running ("xwatch", etc.)

E.g.:

(add-hook 'nnmail-read-incoming-hook
(lambda ()
(call-process "/local/bin/mailsend" nil nil nil
"read"
;; The incoming mail box file.
(expand-file-name (user-login-name)
rmail-spool-directory))))

If you have xwatch running, this will alert it that mail has been read.

If you use display-time, you could use something like this:

(add-hook 'nnmail-read-incoming-hook
(lambda ()
;; Update the displayed time, since that will clear out
;; the flag that says you have mail.
(when (eq (process-status "display-time") 'run)
(display-time-filter display-time-process ""))))

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnmail.el.gz
(defcustom nnmail-read-incoming-hook
  (if (eq system-type 'windows-nt)
      '(nnheader-ms-strip-cr)
    nil)
  "Hook that will be run after the incoming mail has been transferred.
The incoming mail is moved from the specified spool file (which normally is
something like \"/usr/spool/mail/$user\") to the user's home
directory.  This hook is called after the incoming mail box has been
emptied, and can be used to call any mail box programs you have
running (\"xwatch\", etc.)

E.g.:

\(add-hook \\='nnmail-read-incoming-hook
	  (lambda ()
	    (call-process \"/local/bin/mailsend\" nil nil nil
			  \"read\"
			  ;; The incoming mail box file.
			  (expand-file-name (user-login-name)
					    rmail-spool-directory))))

If you have xwatch running, this will alert it that mail has been
read.

If you use `display-time', you could use something like this:

\(add-hook \\='nnmail-read-incoming-hook
	  (lambda ()
	    ;; Update the displayed time, since that will clear out
	    ;; the flag that says you have mail.
	    (when (eq (process-status \"display-time\") \\='run)
	      (display-time-filter display-time-process \"\"))))"
  :group 'nnmail-prepare
  :type 'hook)