;;; feedmail.el --- assist other email packages to massage outgoing messages
;;; This file is in the public domain.
+;; This file is part of GNU Emacs.
+
+;; Author: Bill Carpenter <bill@bubblegum.net>, <bill@carpenter.ORG>
+;; Version: 8
+;; Keywords: email, queue, mail, sendmail, message, spray, smtp, draft
+;; X-URL: <URL:http://www.carpenter.org/feedmail/feedmail.html>
+
;;; Commentary:
;; A replacement for parts of Emacs' sendmail.el (specifically,
;; this specific piece of code. No warranty or promise of support is
;; offered. This code is hereby released into the public domain.
-;; Author: Bill Carpenter <bill@bubblegum.net>, <bill@carpenter.ORG>
-;; Version: 8
-;; Keywords: email, queue, mail, sendmail, message, spray, smtp, draft
-;; Where: <URL:http://www.carpenter.org/feedmail/feedmail.html>
;; Thanks: My thanks to the many people who have sent me suggestions
;; and fixes over time, as well as those who have tested many beta
;; iterations. Some are cited in comments in code fragments below,
;; If you write software that must work without the new custom, you
;; can use this hack stolen from w3-cus.el:
(eval-and-compile
- (condition-case ()
- (require 'custom)
- (error nil))
- (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
- nil ;; We've got what we needed
- ;; We have the old custom-library, hack around it!
- (defmacro defgroup (&rest args)
- nil)
- (defmacro defcustom (var value doc &rest args)
- (` (defvar (, var) (, value) (, doc))))))
-
+ (condition-case ()
+ (require 'custom)
+ (error nil))
+ (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
+ nil ;; We've got what we needed
+ ;; We have the old custom-library, hack around it!
+ (defmacro defgroup (&rest args)
+ nil)
+ (defmacro defcustom (var value doc &rest args)
+ `(defvar ,var ,value ,doc))))
+
+(eval-when-compile (require 'smtpmail))
+(autoload 'mail-do-fcc "sendmail")
(defgroup feedmail nil
"Assist other email packages to massage outgoing messages."
+ :link '(url-link "http://www.carpenter.org/feedmail/feedmail.html")
+ :link '(emacs-commentary-link "feedmail")
:group 'mail)
(defgroup feedmail-misc nil
(defcustom feedmail-nuke-body-in-fcc nil
"*If non-nil remove body of message in copies saved via Fcc:.
-If an positive integer value, leave (up to) that many lines of the
+If a positive integer value, leave (up to) that many lines of the
beginning of the body intact. The result is that the Fcc: copy will
consist only of the message headers, serving as a sort of an outgoing
message log."
:group 'feedmail-headers
- ;;:type 'boolean
:type '(choice (const nil) (const t) integer)
)
(defcustom feedmail-x-mailer-line-user-appendage nil
"*See feedmail-x-mailer-line."
:group 'feedmail-headers
- :type '(choice (const nil) string)
+ :type '(choice (const nil) (const t) string)
)
(defcustom feedmail-fiddle-headers-upwardly t
"*Non-nil means fiddled header fields should go at the top of the header.
-Nil means insert them at the bottom. This is mostly a novelty issue since
+nil means insert them at the bottom. This is mostly a novelty issue since
the standards define the ordering of header fields to be immaterial and it's
fairly likely that some MTA along the way will have its own idea of what the
order should be, regardless of what you specify."
- :group 'feedmail-header
+ :group 'feedmail-headers
:type 'boolean
)
variable feedmail-fiddle-plex-blurb. In contrast to some other fiddle-plex
manipulation functions, in this context, it makes no sense to have an element
which is nil, t, or a simple string."
- :group 'feedmail-header
- :type 'list
+ :group 'feedmail-headers
+ :type '(repeat (choice function)
+ sexp) ; too complex to be described accurately
)
non-nil; (6) stand back and watch co-workers wonder at how efficient
you are at accomplishing inherently inefficient things."
:group 'feedmail-spray
- :type 'list
+ :type 'sexp ; too complex to be described accurately
)
(if (memq system-type '(axp-vms vax-vms))
(expand-file-name (concat (getenv "HOME") "[.MAIL.DRAFT]"))
(concat (getenv "HOME") "/mail/draft"))
- "*Name of an directory where draft messages will be queued.
+ "*Name of a directory where draft messages will be queued.
Directory will be created if necessary. Should be a string that
doesn't end with a slash. Default, except on VMS, is \"$HOME/mail/draft\"."
:group 'feedmail-queue
(defcustom feedmail-prompt-before-queue-user-alist nil
"See feedmail-prompt-before-queue-standard-alist."
:group 'feedmail-queue
- :type 'alist
+ :type '(repeat (cons character function))
)
value, that string is written to the help buffer after the standard info.
It may contain embedded line breaks. It will be printed via princ."
:group 'feedmail-queue
- :type 'string
+ :type '(choice (const nil) string)
)
(on-demand . feedmail-run-the-queue-global-prompt))
"See feedmail-queue-reminder."
:group 'feedmail-queue
- :type 'alist
+ :type '(repeat (cons (choice :tag "Event"
+ (const on-demand)
+ (const after-immediate)
+ (const after-queue)
+ (const after-draft)
+ (const after-run))
+ function))
)
used, but feedmail will do further manipulation on the string you return, so
it's not expected to be a complete filename."
:group 'feedmail-queue
- :type 'string
+ :type '(choice (const :tag "Default" t) string function (const ask))
)
(defvar feedmail-address-list nil)
+(defvar feedmail-queue-runner-is-active nil
+ "*Non-nil means we're inside the logic of the queue-running loop.
+That is, iterating over all messages in the queue to send them. In
+that case, the value is the name of the queued message file currently
+being processed. This can be used for differentiating customized code
+for different scenarios. Users shouldn't set or change this
+variable, but may depend on its value as described here.")
+
+
(defun feedmail-mail-send-hook-splitter ()
"Facilitate dividing mail-send-hook things into queued and immediate cases.
If you have mail-send-hook functions that should only be called for sending/
set `mail-header-separator' to the value of
feedmail-queue-alternative-mail-header-separator and try again."
:group 'feedmail-queue
- :type 'string
+ :type '(choice (const nil) string)
)
)
-(defvar feedmail-queue-runner-is-active nil
- "*Non-nil means we're inside the logic of the queue-running loop.
-That is, iterating over all messages in the queue to send them. In
-that case, the value is the name of the queued message file currently
-being processed. This can be used for differentiating customized code
-for different scenarios. Users shouldn't set or change this
-variable, but may depend on its value as described here.")
-
-
(defvar feedmail-is-a-resend nil
- "*Non-nil means the the message is a Resend (in the RFC-822 sense).
+ "*Non-nil means the message is a Resend (in the RFC-822 sense).
This affects the composition of certain headers. feedmail sets this
variable as soon as it starts prepping the message text buffer, so any
user-supplied functions can rely on it. Users shouldn't set or change this
;; Mon 14-Oct-1996; Douglas Gray Stephens
;; modified to insert error for displaying
(defun feedmail-buffer-to-smtpmail (prepped errors-to addr-listoid)
- "Function which actually calls smtpmail-via-smtp to send buffer as e-mail."
+ "Function which actually calls `smtpmail-via-smtp' to send buffer as e-mail."
;; I'm not sure smtpmail.el is careful about the following
;; return value, but it also uses it internally, so I will fear
;; no evil.
non-nil, feedmail \"smart filling\" is done on VALUE just before
insertion.")
-
+;;;###autoload
(defun feedmail-send-it ()
- "A function which is a suitable value for `send-mail-function'.
-To use it, you probably want something like this in your .emacs or
-similar place:
-
- (setq send-mail-function 'feedmail-send-it)
- (autoload 'feedmail-send-it \"feedmail\")"
+ "Send the current mail buffer using the Feedmail package.
+This is a suitable value for `send-mail-function'. It can be used
+with various lower-level mechanisms to provide features such as queueing."
;; avoid matching trouble over slash vs backslash by getting canonical
(if feedmail-queue-directory
(defun feedmail-queue-send-edit-prompt-help (d-string)
(let ((fqm-help (get-buffer feedmail-p-h-b-n)))
- (if (and fqm-help (get-buffer-window fqm-help))
+ (if (and fqm-help (get-buffer-window fqm-help 'visible))
(feedmail-queue-send-edit-prompt-help-later fqm-help d-string)
(feedmail-queue-send-edit-prompt-help-first d-string))))
(setq blobbet (file-name-nondirectory blobby))
(if (string-match "^[0-9][0-9][0-9]-" blobbet)
(let ((water-mark))
- (setq water-mark (string-to-int (substring blobbet 0 3)))
+ (setq water-mark (string-to-number (substring blobbet 0 3)))
(if (> water-mark high-water) (setq high-water water-mark))))
(setq q-cnt (1+ q-cnt)))
(t (setq q-oth (1+ q-oth)))
"Internal; finds the end of message header fields, returns mark just before it"
(save-excursion
(goto-char (point-min))
- (if (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n") nil noerror)
- (progn
- (forward-line -1)
- (point-marker)))))
+ (when (or (re-search-forward (concat "^"
+ (regexp-quote mail-header-separator)
+ "\n")
+ nil noerror)
+ (and feedmail-queue-alternative-mail-header-separator
+ (re-search-forward
+ (concat "^"
+ (regexp-quote
+ feedmail-queue-alternative-mail-header-separator)
+ "\n")
+ nil noerror)))
+ (forward-line -1)
+ (point-marker))))
(provide 'feedmail)
+
+;;; arch-tag: ec27b380-11c0-4dfd-8436-f636cf2bb992
;;; feedmail.el ends here