Mercurial > emacs
annotate lisp/mail/feedmail.el @ 85527:166fdd1797fe
(Fdump_emacs): Fix typo in message.
(syms_of_emacs) <kill-emacs-hook>: Fix typo in docstring.
<installation-directory>: Reflow docstring.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Mon, 22 Oct 2007 02:14:07 +0000 |
parents | d473c33347de |
children | 1a8ec74a74f3 d38543a1c0f9 |
rev | line source |
---|---|
22609 | 1 ;;; feedmail.el --- assist other email packages to massage outgoing messages |
2 ;;; This file is in the public domain. | |
3 | |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
35616
diff
changeset
|
4 ;; This file is part of GNU Emacs. |
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
35616
diff
changeset
|
5 |
65797
f93aecb355e5
Discard old maintainer email addr.
Richard M. Stallman <rms@gnu.org>
parents:
65587
diff
changeset
|
6 ;; Author: Bill Carpenter <bill@carpenter.ORG> |
33424 | 7 ;; Version: 8 |
8 ;; Keywords: email, queue, mail, sendmail, message, spray, smtp, draft | |
9 ;; X-URL: <URL:http://www.carpenter.org/feedmail/feedmail.html> | |
10 | |
22609 | 11 ;;; Commentary: |
12 | |
13 ;; A replacement for parts of Emacs' sendmail.el (specifically, | |
14 ;; it's what handles your outgoing mail after you hit C-c C-c in mail | |
15 ;; mode). See below for a list of additional features, including the | |
16 ;; ability to queue messages for later sending. If you are using | |
17 ;; fakemail as a subprocess, you can switch to feedmail and eliminate | |
18 ;; the use of fakemail. feedmail works with recent versions of | |
19 ;; Emacs (mostly, but not exclusively, tested against 19.34 on | |
20 ;; Win95; some testing on 20.x) and XEmacs (tested with 20.4 and | |
21 ;; later betas). It probably no longer works with Emacs 18, | |
22 ;; though I haven't tried that in a long time. Sorry, no manual yet | |
23 ;; in this release. Look for one with the next release. | |
22513 | 24 |
25 ;; As far as I'm concerned, anyone can do anything they want with | |
26 ;; this specific piece of code. No warranty or promise of support is | |
27 ;; offered. This code is hereby released into the public domain. | |
28 | |
29 ;; Thanks: My thanks to the many people who have sent me suggestions | |
30 ;; and fixes over time, as well as those who have tested many beta | |
31 ;; iterations. Some are cited in comments in code fragments below, | |
32 ;; but that doesn't correlate well with the list of folks who have | |
33 ;; actually helped me along the way. | |
34 | |
35 ;; If you use feedmail, I invite you to send me some email about it. | |
36 ;; I appreciate feedback about problems you find or suggestions for | |
37 ;; improvements or added features (even though I can't predict when | |
38 ;; I'll incorporate changes). It's also OK with me if you send me a | |
39 ;; note along the lines of "I use feedmail and find it useful" or "I | |
40 ;; tried feedmail and didn't find it useful, so I stopped using it". | |
41 ;; | |
42 ;; It is most useful, when sending a bug report, if you tell me what | |
22609 | 43 ;; version of Emacs you are using, what version of feedmail you are |
22513 | 44 ;; using, and what versions of other email-related elisp packages you |
45 ;; are using. If in doubt about any of that, send the bug report | |
46 ;; anyhow. | |
22609 | 47 ;; |
22513 | 48 ;; ===== |
49 ;; A NOTE TO THOSE WHO WOULD CHANGE THIS CODE... Since it is PD, | |
50 ;; you're within your rights to do whatever you want. If you do | |
51 ;; publish a new version with your changes in it, please (1) insert | |
52 ;; lisp comments describing the changes, (2) insert lisp comments | |
53 ;; that clearly delimit where your changes are, (3) email me a copy | |
54 ;; (I can't always consistently follow the relevant usenet groups), | |
55 ;; and (4) use a version number that is based on the version you're | |
56 ;; changing along with something that indicates you changed it. For | |
57 ;; example, | |
58 ;; | |
59 ;; (defconst feedmail-patch-level "123") | |
60 ;; (defconst feedmail-patch-level "123-XYZ-mods") | |
61 ;; | |
62 ;; The point of the last item, of course, is to try to minimize | |
63 ;; confusion. Odds are good that if your idea makes sense to me that | |
64 ;; it will show up in some future version of feedmail, though it's | |
65 ;; hard to say when releases will tumble out. | |
66 ;; ===== | |
67 ;; | |
68 ;; This file requires the mail-utils library. | |
69 ;; | |
70 ;; This file requires the smtpmail library if you use | |
71 ;; feedmail-buffer-to-smtpmail. | |
72 ;; | |
73 ;; This file requires the custom library. Unfortunately, there are | |
74 ;; two incompatible versions of the custom library. If you don't have | |
75 ;; custom or you have the old version, this file will still load and | |
76 ;; work properly. If you don't know what custom is all about and want | |
77 ;; to edit your user option elisp variables the old fashioned way, | |
78 ;; just imagine that all the "defcustom" stuff you see below is really | |
79 ;; "defvar", and ignore everthing else. For info about custom, see | |
80 ;; <URL:http://www.dina.kvl.dk/~abraham/custom/>. | |
81 ;; | |
82 ;; This code does in elisp a superset of the stuff that used to be done | |
83 ;; by the separate program "fakemail" for processing outbound email. | |
84 ;; In other words, it takes over after you hit "C-c C-c" in mail mode. | |
85 ;; By appropriate setting of options, you can still use "fakemail", | |
86 ;; or you can even revert to sendmail (which is not too popular | |
87 ;; locally). See the variables at the top of the elisp for how to | |
88 ;; achieve these effects (there are more features than in this bullet | |
89 ;; list, so trolling through the variable and function doc strings may | |
90 ;; be worth your while): | |
91 ;; | |
92 ;; --- you can park outgoing messages into a disk-based queue and | |
93 ;; stimulate sending them all later (handy for laptop users); | |
94 ;; there is also a queue for draft messages | |
95 ;; | |
96 ;; --- you can get one last look at the prepped outbound message and | |
97 ;; be prompted for confirmation | |
98 ;; | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
99 ;; --- removes Bcc:/Resent-Bcc: headers after getting address info |
22513 | 100 ;; |
101 ;; --- does smart filling of address headers | |
102 ;; | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
103 ;; --- calls a routine to process Fcc: lines and removes them |
22513 | 104 ;; |
105 ;; --- empty headers are removed | |
106 ;; | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
107 ;; --- can force From: or Sender: line |
22513 | 108 ;; |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
109 ;; --- can generate a Message-Id: line |
22513 | 110 ;; |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
111 ;; --- can generate a Date: line; the date can be the time the |
22513 | 112 ;; message was written or the time it is being sent |
113 ;; | |
114 ;; --- strips comments from address info (both "()" and "<>" are | |
115 ;; handled via a call to mail-strip-quoted-names); the | |
116 ;; comments are stripped in the simplified address list given | |
117 ;; to a subprocess, not in the headers in the mail itself | |
118 ;; (they are left unchanged, modulo smart filling) | |
119 ;; | |
120 ;; --- error info is pumped into a normal buffer instead of the | |
121 ;; minibuffer | |
122 ;; | |
123 ;; --- just before the optional prompt for confirmation, lets you | |
124 ;; run a hook on the prepped message and simplified address | |
125 ;; list | |
126 ;; | |
127 ;; --- you can specify something other than /bin/mail for the | |
128 ;; subprocess | |
129 ;; | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
130 ;; --- you can generate/modify an X-Mailer: message header |
22513 | 131 ;; |
132 ;; After a long list of options below, you will find the function | |
133 ;; feedmail-send-it. Hers's the best way to use the stuff in this | |
134 ;; file: | |
135 ;; | |
136 ;; Save this file as feedmail.el somewhere on your elisp | |
137 ;; loadpath; byte-compile it. Put the following lines somewhere in | |
138 ;; your ~/.emacs stuff: | |
139 ;; | |
140 ;; (setq send-mail-function 'feedmail-send-it) | |
141 ;; (autoload 'feedmail-send-it "feedmail") | |
142 ;; | |
143 ;; If you plan to use the queue stuff, also use this: | |
144 ;; | |
145 ;; (setq feedmail-enable-queue t) | |
146 ;; (autoload 'feedmail-run-the-queue "feedmail") | |
147 ;; (autoload 'feedmail-run-the-queue-no-prompts "feedmail") | |
148 ;; (setq auto-mode-alist (cons '("\\.fqm$" . mail-mode) auto-mode-alist)) | |
149 ;; | |
22609 | 150 ;; If you are using the desktop.el library to restore your sessions, you might |
22513 | 151 ;; like to add the suffix ".fqm" to the list of non-saved things via the variable |
152 ;; desktop-files-not-to-save. | |
153 ;; | |
154 ;; If you are planning to call feedmail-queue-reminder from your .emacs or | |
155 ;; something similar, you might need this: | |
156 ;; | |
157 ;; (autoload 'feedmail-queue-reminder "feedmail") | |
158 ;; | |
159 ;; If you ever use rmail-resend and queue messages, you should do this: | |
160 ;; | |
161 ;; (setq feedmail-queue-alternative-mail-header-separator "") | |
162 ;; | |
163 ;; If you want to automatically spell-check messages, but not when sending | |
164 ;; them from the queue, you could do something like this: | |
165 ;; | |
166 ;; (autoload 'feedmail-mail-send-hook-splitter "feedmail") | |
167 ;; (add-hook 'mail-send-hook 'feedmail-mail-send-hook-splitter) | |
168 ;; (add-hook 'feedmail-mail-send-hook 'ispell-message) | |
169 ;; | |
170 ;; If you are using message-mode to compose and send mail, feedmail will | |
171 ;; probably work fine with that (someone else tested it and told me it worked). | |
172 ;; Follow the directions above, but make these adjustments instead: | |
173 ;; | |
174 ;; (setq message-send-mail-function 'feedmail-send-it) | |
175 ;; (add-hook 'message-mail-send-hook 'feedmail-mail-send-hook-splitter) | |
176 ;; | |
177 ;; I think the LCD is no longer being updated, but if it were, this | |
178 ;; would be a proper LCD record. There is an old version of | |
179 ;; feedmail.el in the LCD archive. It works but is missing a lot of | |
180 ;; features. | |
181 ;; | |
182 ;; LCD record: | |
183 ;; feedmail|Bill Carpenter|bill@bubblegum.net,bill@carpenter.ORG|Outbound mail queue handling|98-06-15|8|feedmail.el | |
184 ;; | |
185 ;; Change log: | |
186 ;; original, 31 March 1991 | |
187 ;; patchlevel 1, 5 April 1991 | |
188 ;; patchlevel 2, 24 May 1991 | |
189 ;; 5-may-92 jwz Conditionalized calling expand-mail-aliases, since that | |
22609 | 190 ;; function doesn't exist in Lucid Emacs or when using |
22513 | 191 ;; mail-abbrevs.el. |
192 ;; patchlevel 3, 3 October 1996 | |
193 ;; added queue stuff; still works in v18 | |
194 ;; patchlevel 4, issued by someone else | |
195 ;; patchlevel 5, issued by someone else | |
196 ;; patchlevel 6, not issued as far as I know | |
197 ;; patchlevel 7, 20 May 1997 | |
22609 | 198 ;; abandon futile support of Emacs 18 (sorry if that hurts you) |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
199 ;; provide a Date: header by default |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
200 ;; provide a default for generating Message-Id: header contents |
22513 | 201 ;; and use it by default (slightly changed API) |
202 ;; return value from feedmail-run-the-queue | |
203 ;; new wrapper function feedmail-run-the-queue-no-prompts | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
204 ;; user-mail-address as default for From: |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
205 ;; properly deal with Resent-{To,Cc,Bcc} |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
206 ;; Bcc and Resent-* now included in smart filling |
22513 | 207 ;; limited support for a "drafts" directory |
208 ;; user-configurable default message action | |
209 ;; allow timeout for confirmation prompt (where available) | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
210 ;; move Fcc handling to as late as possible to get max |
22513 | 211 ;; header munging in the saved file |
212 ;; work around sendmail.el's prompts when working from queue | |
213 ;; more reliably detect voluntary user bailouts | |
214 ;; offer to save modified buffers visiting queue files | |
215 ;; offer to delete old file copies of messages being queued | |
216 ;; offer to delete queue files when sending immediately | |
217 ;; queue filename convention preserves queue order | |
218 ;; default queue and draft directory names that work on VMS | |
219 ;; deduced address list now really a list, not a string (API change) | |
220 ;; no more address buffer | |
221 ;; when sending immediately, brief reminder of queue/draft counts | |
222 ;; copy trace of smtpmail stuff to feedmail error buffer on no-go | |
223 ;; more granularity on when to confirm sending | |
224 ;; pause a bit for errors while running queue | |
225 ;; try to clean up some pesky auto-save files from the | |
226 ;; queue/draft directories | |
227 ;; feedmail-force-expand-mail-aliases in case you can't figure | |
228 ;; any other way | |
229 ;; cleanup some of my sloppiness about case-fold-search (a strange | |
230 ;; variable) | |
22609 | 231 ;; best effort following coding conventions from Emacs |
22513 | 232 ;; elisp manual appendix |
233 ;; "customize" (see custom.el) | |
234 ;; when user selects "immediate send", clear action prompt since | |
235 ;; hooks may take a while to operate, and user may think the | |
236 ;; response didn't take | |
237 ;; fixes to the argument conventions for the | |
238 ;; feedmail-queue-runner-* functions; allows | |
239 ;; feedmail-run-the-queue[-no-prompts] to properly be called | |
240 ;; non-interactively | |
241 ;; eliminate reliance on directory-sep-char and feedmail-sep-thing | |
242 ;; tweak smart filling (reminded of comma problem by levitte@lp.se) | |
243 ;; option to control writing in text vs binary mode | |
22552 | 244 ;; patchlevel 8, 15 June 1998 |
22513 | 245 ;; reliable re-editing of text-mode (vs binary) queued messages |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
246 ;; user option to keep Bcc: in Fcc: copy (keep by default) |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
247 ;; user option to delete body from Fcc: copy (keep by default) |
22513 | 248 ;; feedmail-deduce-bcc-where for envelope (API change for |
249 ;; feedmail-deduce-address list) | |
250 ;; feedmail-queue-alternative-mail-header-separator | |
251 ;; at message action prompt, "I"/"S" bypass message confirmation prompt | |
252 ;; feedmail-mail-send-hook-splitter, feedmail-mail-send-hook, | |
253 ;; feedmail-mail-send-hook-queued | |
254 ;; user can supply stuff for message action prompt | |
255 ;; variable feedmail-queue-runner-confirm-global, function feedmail-run-the-queue-global-prompt | |
256 ;; bugfix: absolute argument to directory-files (tracked down for me | |
257 ;; by gray@austin.apc.slb.com (Douglas Gray Stephens)); relative | |
258 ;; pathnames can tickle stuff in ange-ftp remote directories | |
259 ;; (perhaps because feedmail is careless about its working | |
260 ;; directory) | |
261 ;; feedmail-deduce-envelope-from | |
262 ;; always supply envelope "from" (user-mail-address) to sendmail | |
263 ;; feedmail-message-id-suffix | |
264 ;; feedmail-queue-reminder, feedmail-queue-reminder-alist (after suggestions | |
265 ;; and/or code fragments from tonyl@Eng.Sun.COM (Tony Lam) and | |
266 ;; burge@newvision.com (Shane Burgess); bumped up the default value of | |
267 ;; feedmail-queue-chatty-sit-for since info is more complex sometimes | |
268 ;; feedmail-enable-spray (individual transmissions, crude mailmerge) | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
269 ;; blank Subject: no longer a special case; see feedmail-nuke-empty-headers |
22513 | 270 ;; fiddle-plexes data structure used lots of places; see feedmail-fiddle-plex-blurb |
271 ;; feedmail-fiddle-plex-user-list | |
272 ;; feedmail-is-a-resend | |
273 ;; honor mail-from-style in constructing default for feedmail-from-line | |
274 ;; re-implement feedmail-from-line and feedmail-sender-line with | |
275 ;; fiddle-plexes; slightly modified semantics for feedmail-sender-line | |
276 ;; feedmail-queue-default-file-slug; tidy up some other slug details | |
277 ;; feedmail-queue-auto-file-nuke | |
278 ;; feedmail-queue-express-to-queue and feedmail-queue-express-to-draft | |
279 ;; strong versions of "q"ueue and "d"raft answers (always make a new file) | |
280 ;; | |
281 ;; todo (probably in patchlevel 9): | |
282 ;; write texinfo manual | |
283 ;; maybe partition into multiple files, including files of examples | |
284 ;; | |
285 ;;; Code: | |
286 | |
287 (defconst feedmail-patch-level "8") | |
288 | |
289 | |
290 ;; from <URL:http://www.dina.kvl.dk/~abraham/custom/>: | |
291 ;; If you write software that must work without the new custom, you | |
292 ;; can use this hack stolen from w3-cus.el: | |
293 (eval-and-compile | |
41608
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39477
diff
changeset
|
294 (condition-case () |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39477
diff
changeset
|
295 (require 'custom) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39477
diff
changeset
|
296 (error nil)) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39477
diff
changeset
|
297 (if (and (featurep 'custom) (fboundp 'custom-declare-variable)) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39477
diff
changeset
|
298 nil ;; We've got what we needed |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39477
diff
changeset
|
299 ;; We have the old custom-library, hack around it! |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39477
diff
changeset
|
300 (defmacro defgroup (&rest args) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39477
diff
changeset
|
301 nil) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39477
diff
changeset
|
302 (defmacro defcustom (var value doc &rest args) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39477
diff
changeset
|
303 `(defvar ,var ,value ,doc)))) |
22513 | 304 |
33984 | 305 (eval-when-compile (require 'smtpmail)) |
306 (autoload 'mail-do-fcc "sendmail") | |
22513 | 307 |
308 (defgroup feedmail nil | |
309 "Assist other email packages to massage outgoing messages." | |
33984 | 310 :link '(url-link "http://www.carpenter.org/feedmail/feedmail.html") |
42787
b61ebf167ba0
(feedmail): Fix :link spec.
Andreas Schwab <schwab@suse.de>
parents:
42706
diff
changeset
|
311 :link '(emacs-commentary-link "feedmail") |
22513 | 312 :group 'mail) |
313 | |
314 (defgroup feedmail-misc nil | |
315 "Miscellaneous feedmail options that don't fit in other groups." | |
316 :group 'feedmail) | |
317 | |
318 (defgroup feedmail-headers nil | |
319 "Options related to manipulating specific headers or types of headers." | |
320 :group 'feedmail) | |
321 | |
322 (defgroup feedmail-queue nil | |
323 "Options related to queuing messages for later sending." | |
324 :group 'feedmail) | |
325 | |
326 | |
327 (defcustom feedmail-confirm-outgoing nil | |
328 "*If non-nil, give a y-or-n confirmation prompt before sending mail. | |
329 This is done after the message is completely prepped, and you'll be | |
330 looking at the top of the message in a buffer when you get the prompt. | |
331 If set to the symbol 'queued, give the confirmation prompt only while | |
332 running the queue (however, the prompt is always suppressed if you are | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
333 processing the queue via `feedmail-run-the-queue-no-prompts'). If set |
22513 | 334 to the symbol 'immediate, give the confirmation prompt only when |
335 sending immediately. For any other non-nil value, prompt in both | |
336 cases. You can give a timeout for the prompt; see variable | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
337 `feedmail-confirm-outgoing-timeout'." |
22513 | 338 :group 'feedmail-misc |
339 :type 'boolean | |
340 ) | |
341 | |
342 | |
343 (defcustom feedmail-confirm-outgoing-timeout nil | |
344 "*If non-nil, a timeout in seconds at the send confirmation prompt. | |
345 If a positive number, it's a timeout before sending. If a negative | |
346 number, it's a timeout before not sending. This will not work if your | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
347 version of Emacs doesn't include the function `y-or-n-p-with-timeout' |
22609 | 348 \(e.g., some versions of XEmacs\)." |
22513 | 349 :group 'feedmail-misc |
350 :type '(choice (const nil) integer) | |
22799 | 351 ) |
22513 | 352 |
353 | |
354 (defcustom feedmail-nuke-bcc t | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
355 "*If non-nil remove Bcc: lines from the message headers. |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
356 In any case, the Bcc: lines do participate in the composed address |
22513 | 357 list. You may want to leave them in if you're using sendmail |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
358 \(see `feedmail-buffer-eating-function'\)." |
22513 | 359 :group 'feedmail-headers |
360 :type 'boolean | |
22799 | 361 ) |
22513 | 362 |
363 | |
364 (defcustom feedmail-nuke-resent-bcc t | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
365 "*If non-nil remove Resent-Bcc: lines from the message headers. |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
366 In any case, the Resent-Bcc: lines do participate in the composed |
22513 | 367 address list. You may want to leave them in if you're using sendmail |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
368 \(see `feedmail-buffer-eating-function'\)." |
22513 | 369 :group 'feedmail-headers |
370 :type 'boolean | |
22799 | 371 ) |
22513 | 372 |
373 | |
374 (defcustom feedmail-deduce-bcc-where nil | |
22609 | 375 "*Where Bcc:/Resent-Bcc: addresses should appear in the envelope list. |
22513 | 376 Addresses for the message envelope are deduced by examining |
377 appropriate address headers in the message. Generally, they will show | |
378 up in the list of deduced addresses in the order that the headers | |
379 happen to appear (duplicate addresses are eliminated in any case). | |
380 This variable can be set to the symbol 'first, in which case the | |
22609 | 381 Bcc:/Resent-Bcc: addresses will appear at the beginning in the list; |
22513 | 382 or, it can be set to the symbol 'last, in which case they will appear |
383 at the end of the list. | |
384 | |
385 Why should you care? Well, maybe you don't, and certainly the same | |
386 things could be accomplished by affecting the order of message headers | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
387 in the outgoing message. Some people use Bcc: as a way of getting |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
388 their own \"come back\" copy of each message they send. If Bcc: |
22513 | 389 addresses are not handled first, there can be substantial delays in |
390 seeing the message again. Some configurations of sendmail, for example, | |
391 seem to try to deliver to each addressee at least once, immediately | |
392 and serially, so slow SMTP conversations can add up to a delay. There | |
393 is an option for either 'first or 'last because you might have a | |
394 delivery agent that processes the addresses backwards." | |
395 :group 'feedmail-headers | |
396 :type 'boolean | |
22799 | 397 ) |
22513 | 398 |
399 | |
400 (defcustom feedmail-fill-to-cc t | |
401 "*If non-nil do smart filling of addressee header lines. | |
402 Smart filling means breaking long lines at appropriate points and | |
403 making continuation lines. Despite the function name, it includes | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
404 To:, Cc:, Bcc: (and their Resent-* forms), as well as From: and |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
405 Reply-To: (though they seldom need it). If nil, the lines are left |
22513 | 406 as-is. The filling is done after mail address alias expansion." |
407 :group 'feedmail-headers | |
408 :type 'boolean | |
22799 | 409 ) |
22513 | 410 |
411 | |
412 (defcustom feedmail-fill-to-cc-fill-column default-fill-column | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
413 "*Fill column used by `feedmail-fill-to-cc'." |
22513 | 414 :group 'feedmail-headers |
415 :type 'integer | |
22799 | 416 ) |
22513 | 417 |
418 | |
419 (defcustom feedmail-nuke-bcc-in-fcc nil | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
420 "*If non-nil remove [Resent-]Bcc: lines in message copies saved via Fcc:. |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
421 This is independent of whether the Bcc: header lines are actually sent |
22513 | 422 with the message (see feedmail-nuke-bcc). Though not implied in the name, |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
423 the same Fcc: treatment applies to both Bcc: and Resent-Bcc: lines." |
22513 | 424 :group 'feedmail-headers |
425 :type 'boolean | |
22799 | 426 ) |
22513 | 427 |
428 | |
429 (defcustom feedmail-nuke-body-in-fcc nil | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
430 "*If non-nil remove body of message in copies saved via Fcc:. |
47926
5e18e835d9fa
(feedmail-nuke-body-in-fcc, feedmail-queue-draft-directory): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
42787
diff
changeset
|
431 If a positive integer value, leave (up to) that many lines of the |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
432 beginning of the body intact. The result is that the Fcc: copy will |
22513 | 433 consist only of the message headers, serving as a sort of an outgoing |
434 message log." | |
435 :group 'feedmail-headers | |
436 :type '(choice (const nil) (const t) integer) | |
22799 | 437 ) |
22513 | 438 |
439 | |
440 (defcustom feedmail-force-expand-mail-aliases nil | |
22609 | 441 "*If non-nil, force the calling of `expand-mail-aliases'. |
22513 | 442 Normally, feedmail tries to figure out if you're using mailalias or |
22609 | 443 mailabbrevs and only calls `expand-mail-aliases' if it thinks you're |
22513 | 444 using the mailalias package. This user option can be used to force |
445 the issue since there are configurations which fool the figuring | |
446 out." | |
447 :group 'feedmail-headers | |
448 :type 'boolean | |
22799 | 449 ) |
22513 | 450 |
451 | |
452 (defcustom feedmail-nuke-empty-headers t | |
453 "*If non-nil, remove header lines which have no contents. | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
454 A completely empty Subject: header is always removed, regardless of |
22513 | 455 the setting of this variable. The only time you would want them left |
456 in would be if you used some headers whose presence indicated | |
457 something rather than their contents. This is rare in Internet email | |
458 but common in some proprietary systems." | |
459 :group 'feedmail-headers | |
460 :type 'boolean | |
22799 | 461 ) |
22513 | 462 |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
463 ;; wjc sez: I think the use of the Sender: line is pretty pointless, |
22513 | 464 ;; but I left it in to be compatible with sendmail.el and because |
465 ;; maybe some distant mail system needs it. Really, though, if you | |
466 ;; want a sender line in your mail, just put one in there and don't | |
467 ;; wait for feedmail to do it for you. (Yes, I know all about | |
468 ;; RFC-822 and RFC-1123, but are you *really* one of those cases | |
469 ;; they're talking about? I doubt it.) | |
470 (defcustom feedmail-sender-line nil | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
471 "*If non-nil and the email has no Sender: header, use this value. |
22513 | 472 May be nil, in which case nothing in particular is done with respect |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
473 to Sender: lines. By design, will not replace an existing Sender: |
22513 | 474 line, but you can achieve that with a fiddle-plex 'replace action. |
475 NB: it makes no sense to use the value t since there is no sensible | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
476 default for Sender:. |
22513 | 477 |
478 If not nil, it may be a string, a fiddle-plex, or a function which | |
479 returns either nil, t, a string, or a fiddle-plex (or, in fact, | |
480 another function, but let's not be ridiculous). If a string, it | |
481 should be just the contents of the header, not the name of the header | |
482 itself nor the trailing newline. If a function, it will be called | |
483 with no arguments. For an explanation of fiddle-plexes, see the | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
484 documentation for the variable `feedmail-fiddle-plex-blurb'. In all |
22513 | 485 cases the name element of the fiddle-plex is ignored and is hardwired |
486 by feedmail to either \"X-Sender\" or \"X-Resent-Sender\". | |
487 | |
488 You can probably leave this nil, but if you feel like using it, a good | |
489 value would be a string of a fully-qualified domain name form of your | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
490 address. For example, \"bill@bubblegum.net (WJCarpenter)\". The Sender: |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
491 header is fiddled after the From: header is fiddled." |
22513 | 492 :group 'feedmail-headers |
493 :type '(choice (const nil) string) | |
22799 | 494 ) |
22513 | 495 |
496 | |
497 (defcustom feedmail-force-binary-write t | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
498 "*If non-nil, force writing file as binary (this applies to queues and Fcc:). |
22513 | 499 On systems where there is a difference between binary and text files, |
22609 | 500 feedmail will temporarily manipulate the values of `buffer-file-type' |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
501 and/or `default-buffer-file-type' to make the writing as binary. If |
22513 | 502 nil, writing will be in text mode. On systems where there is no |
503 distinction or where it is controlled by other variables or other | |
504 means, this option has no effect." | |
505 :group 'feedmail-misc | |
506 :type 'boolean | |
22799 | 507 ) |
22513 | 508 |
509 | |
510 (defcustom feedmail-from-line t | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
511 "*If non-nil and the email has no From: header, use this value. |
22513 | 512 May be t, in which case a default is computed (and you probably won't |
513 be happy with it). May be nil, in which case nothing in particular is | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
514 done with respect to From: lines. By design, will not replace an |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
515 existing From: line, but you can achieve that with a fiddle-plex 'replace |
22513 | 516 action. |
517 | |
518 If neither nil nor t, it may be a string, a fiddle-plex, or a function | |
519 which returns either nil, t, a string, or a fiddle-plex (or, in fact, | |
520 another function, but let's not be ridiculous). If a string, it | |
521 should be just the contents of the header, not the name of the header | |
522 itself nor the trailing newline. If a function, it will be called | |
523 with no arguments. For an explanation of fiddle-plexes, see the | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
524 documentation for the variable `feedmail-fiddle-plex-blurb'. In all |
22513 | 525 cases the name element of the fiddle-plex is ignored and is hardwired |
526 by feedmail to either \"X-From\" or \"X-Resent-From\". | |
527 | |
528 A good value would be a string fully-qualified domain name form of | |
529 your address. For example, \"bill@bubblegum.net (WJCarpenter)\". The | |
530 default value of this variable uses the standard elisp variable | |
22609 | 531 `user-mail-address' which should be set on every system but has a decent |
532 chance of being wrong. It also honors `mail-from-style'. Better to set | |
22513 | 533 this variable explicitly to the string you want or find some other way |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
534 to arrange for the message to get a From: line." |
22513 | 535 :group 'feedmail-headers |
23222 | 536 :type '(choice (const t) (const nil) string) |
22799 | 537 ) |
22513 | 538 |
539 | |
540 (defcustom feedmail-deduce-envelope-from t | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
541 "*If non-nil, deduce message envelope \"from\" from header From: or Sender:. |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
542 In other words, if there is a Sender: header in the message, temporarily |
22609 | 543 change the value of `user-mail-address' to be the same while the message |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
544 is being sent. If there is no Sender: header, use the From: header, |
22513 | 545 if any. Address values are taken from the actual message just before |
546 it is sent, and the process is independent of the values of | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
547 `feedmail-from-line' and/or `feedmail-sender-line'. |
22513 | 548 |
549 There are many and good reasons for having the message header | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
550 From:/Sender: be different from the message envelope \"from\" |
22513 | 551 information. However, for most people and for most circumstances, it |
552 is usual for them to be the same (this is probably especially true for | |
553 the case where the user doesn't understand the difference between the | |
554 two in the first place). | |
555 | |
556 The idea behind this feature is that you can have everything set up | |
557 some normal way for yourself. If for some reason you want to send a | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
558 message with another From: line, you can just type it at the top of |
22513 | 559 the message, and feedmail will take care of \"fixing up\" the envelope |
560 \"from\". This only works for mail senders which make use of | |
22609 | 561 `user-mail-address' as the envelope \"from\" value. For some mail |
22513 | 562 senders (e.g., feedmail-buffer-to-bin-mail), there is no simple way to |
563 influence what they will use as the envelope." | |
564 :group 'feedmail-headers | |
565 :type 'boolean | |
22799 | 566 ) |
22513 | 567 |
568 | |
569 (defcustom feedmail-x-mailer-line-user-appendage nil | |
570 "*See feedmail-x-mailer-line." | |
571 :group 'feedmail-headers | |
23265
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
572 :type '(choice (const nil) (const t) string) |
22799 | 573 ) |
22513 | 574 |
575 | |
576 (defcustom feedmail-x-mailer-line t | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
577 "*Control the form of an X-Mailer: header in an outgoing message. |
22513 | 578 Moderately useful for debugging, keeping track of your correspondents' |
579 mailer preferences, or just wearing your MUA on your sleeve. You | |
580 should probably know that some people are fairly emotional about the | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
581 presence of X-Mailer: lines in email. |
22513 | 582 |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
583 If nil, nothing is done about X-Mailer:. |
22513 | 584 |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
585 If t, an X-Mailer: header of a predetermined format is produced, |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
586 combining its efforts with any existing X-Mailer: header. If you want |
22513 | 587 to take the default construct and just add a little blob of your own |
588 at the end, define the variable feedmail-x-mailer-line-user-appendage | |
22609 | 589 as that blob string. A value of t is equivalent to using the function |
22513 | 590 feedmail-default-x-mailer-generator. |
591 | |
592 If neither nil nor t, it may be a string, a fiddle-plex, or a function | |
593 which returns either nil, t, a string, or a fiddle-plex (or, in fact, | |
594 another function, but let's not be ridiculous). If a string, it | |
595 should be just the contents of the header, not the name of the header | |
596 itself nor the trailing newline. If a function, it will be called | |
597 with no arguments. For an explanation of fiddle-plexes, see the | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
598 documentation for the variable `feedmail-fiddle-plex-blurb'. In all |
22513 | 599 cases the name element of the fiddle-plex is ignored and is hardwired |
600 by feedmail to either \"X-Mailer\" or \"X-Resent-Mailer\"." | |
601 :group 'feedmail-headers | |
602 :type '(choice (const t) (const nil) string function) | |
22799 | 603 ) |
22513 | 604 |
605 | |
606 (defcustom feedmail-message-id-generator t | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
607 "*Specifies the creation of a Message-Id: header field. |
22513 | 608 |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
609 If nil, nothing is done about Message-Id:. |
22513 | 610 |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
611 If t, a Message-Id: header of a predetermined format is produced, but |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
612 only if there is not already a Message-Id: in the message. A value of |
22513 | 613 t is equivalent to using the function feedmail-default-message-id-generator. |
614 | |
615 If neither nil nor t, it may be a string, a fiddle-plex, or a function | |
616 which returns either nil, t, a string, or a fiddle-plex (or, in fact, | |
617 another function, but let's not be ridiculous). If a string, it | |
618 should be just the contents of the header, not the name of the header | |
619 itself nor the trailing newline. If a function, it will be called | |
620 with one argument: the possibly-nil name of the file associated with | |
621 the message buffer. For an explanation of fiddle-plexes, see the | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
622 documentation for the variable `feedmail-fiddle-plex-blurb'. In all |
22513 | 623 cases the name element of the fiddle-plex is ignored and is hardwired |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
624 by feedmail to either \"Message-Id\" or \"Resent-Message-Id\". |
22513 | 625 |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
626 You should let feedmail generate a Message-Id: for you unless you are sure |
22513 | 627 that whatever you give your messages to will do it for you (e.g., most |
628 configurations of sendmail). Even if the latter case is true, it | |
629 probably won't hurt you to generate your own, and it will then show up | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
630 in the saved message if you use Fcc:." |
22513 | 631 :group 'feedmail-headers |
76123
49ec84aacf0b
(feedmail-message-id-generator, feedmail-date-generator): Fix custom types.
John Paul Wallington <jpw@pobox.com>
parents:
73728
diff
changeset
|
632 :type '(choice (const t) (const nil) function) |
22799 | 633 ) |
22513 | 634 |
635 | |
636 (defcustom feedmail-message-id-suffix nil | |
22609 | 637 "*If non-nil, used as a suffix for generating unique Message-Id: headers. |
638 The function `feedmail-default-message-id-generator' creates its work based | |
22513 | 639 on a formatted date-time string, a random number, and a domain-looking suffix. |
22609 | 640 You can control the suffix used by assigning a string value to this variable. |
641 If you don't supply one, the value of the variable `user-mail-address' will be | |
642 used. If the value of `feedmail-message-id-suffix' contains an \"@\" character, | |
643 the string will be used verbatim, else an \"@\" character will be prepended | |
644 automatically." | |
22513 | 645 :group 'feedmail-headers |
23222 | 646 :type '(choice (const nil) string) |
22799 | 647 ) |
22513 | 648 |
649 ;; this was suggested in various forms by several people; first was | |
650 ;; Tony DeSimone in Oct 1992; sorry to be so tardy | |
651 (defcustom feedmail-date-generator t | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
652 "*Specifies the creation of a Date: header field. |
22513 | 653 |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
654 If nil, nothing is done about Date:. |
22513 | 655 |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
656 If t, a Date: header of a predetermined format is produced, but only |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
657 if there is not already a Date: in the message. A value of t is |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
658 equivalent to using the function `feedmail-default-date-generator'. |
22513 | 659 |
660 If neither nil nor t, it may be a string, a fiddle-plex, or a function | |
661 which returns either nil, t, a string, or a fiddle-plex (or, in fact, | |
662 another function, but let's not be ridiculous). If a string, it | |
663 should be just the contents of the header, not the name of the header | |
664 itself nor the trailing newline. If a function, it will be called | |
665 with one argument: the possibly-nil name of the file associated with | |
666 the message buffer. For an explanation of fiddle-plexes, see the | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
667 documentation for the variable `feedmail-fiddle-plex-blurb'. In all |
22513 | 668 cases the name element of the fiddle-plex is ignored and is hardwired |
669 by feedmail to either \"Date\" or \"Resent-Date\". | |
670 | |
671 If you decide to format your own date field, do us all a favor and know | |
672 what you're doing. Study the relevant parts of RFC-822 and RFC-1123. | |
673 Don't make me come up there! | |
674 | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
675 You should let feedmail generate a Date: for you unless you are sure |
22513 | 676 that whatever you give your messages to will do it for you (e.g., most |
677 configurations of sendmail). Even if the latter case is true, it | |
678 probably won't hurt you to generate your own, and it will then show up | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
679 in the saved message if you use Fcc:." |
22513 | 680 :group 'feedmail-headers |
76123
49ec84aacf0b
(feedmail-message-id-generator, feedmail-date-generator): Fix custom types.
John Paul Wallington <jpw@pobox.com>
parents:
73728
diff
changeset
|
681 :type '(choice (const t) (const nil) function) |
22799 | 682 ) |
22513 | 683 |
684 | |
685 (defcustom feedmail-fiddle-headers-upwardly t | |
22609 | 686 "*Non-nil means fiddled header fields should go at the top of the header. |
42206 | 687 nil means insert them at the bottom. This is mostly a novelty issue since |
22513 | 688 the standards define the ordering of header fields to be immaterial and it's |
689 fairly likely that some MTA along the way will have its own idea of what the | |
690 order should be, regardless of what you specify." | |
48378
f5dd8ebce303
(feedmail-fiddle-headers-upwardly,feedmail-fiddle-plex-user-list):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47926
diff
changeset
|
691 :group 'feedmail-headers |
22513 | 692 :type 'boolean |
693 ) | |
694 | |
695 | |
696 (defcustom feedmail-fiddle-plex-user-list nil | |
697 "If non-nil, should be a list of one or more fiddle-plexes. | |
698 Each element of the list can also be a function which returns a | |
699 fiddle-plex. | |
700 | |
701 feedmail will use this list of fiddle-plexes to manipulate user-specified | |
702 message header fields. It does this after it has completed all normal | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
703 message header field manipulation and before calling `feedmail-last-chance-hook'. |
22513 | 704 |
705 For an explanation of fiddle-plexes, see the documentation for the | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
706 variable `feedmail-fiddle-plex-blurb'. In contrast to some other fiddle-plex |
22513 | 707 manipulation functions, in this context, it makes no sense to have an element |
708 which is nil, t, or a simple string." | |
48378
f5dd8ebce303
(feedmail-fiddle-headers-upwardly,feedmail-fiddle-plex-user-list):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47926
diff
changeset
|
709 :group 'feedmail-headers |
23265
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
710 :type '(repeat (choice function) |
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
711 sexp) ; too complex to be described accurately |
22513 | 712 ) |
713 | |
714 | |
715 (defcustom feedmail-enable-spray nil | |
716 "If non-nil, transmit message separately to each addressee. | |
717 feedmail normally accumulates a list of addressees and passes the message | |
718 along with that list to a buffer-eating function which expects any number | |
719 of addressees. If this variable is non-nil, however, feedmail will | |
720 repeatedly call the same buffer-eating function. Each time, the list of | |
721 addressees will be just one item from the original list. This only affects | |
22609 | 722 the message envelope addresses and doesn't affect what appears in the |
22513 | 723 message headers except as noted. |
724 | |
725 Spray mode is usually pointless, and if you can't think of a good reason for | |
22609 | 726 it, you should avoid it since it is inherently less efficient than normal |
22513 | 727 multiple delivery. One reason to use it is to overcome mis-featured mail |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
728 transports which betray your trust by revealing Bcc: addressees in the |
22513 | 729 headers of a message. Another use is to do a crude form of mailmerge, for |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
730 which see `feedmail-spray-address-fiddle-plex-list'. |
22513 | 731 |
732 If one of the calls to the buffer-eating function results in an error, | |
733 what happens next is carelessly defined, so beware." | |
734 :group 'feedmail-spray | |
735 :type 'boolean | |
736 ) | |
737 | |
738 (defvar feedmail-spray-this-address nil | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
739 "Do not set or change this variable. See `feedmail-spray-address-fiddle-plex-list'.") |
22513 | 740 |
741 (defcustom feedmail-spray-address-fiddle-plex-list nil | |
742 "User-supplied specification for a crude form of mailmerge capability. | |
743 When spraying is enabled, feedmail composes a list of envelope addresses. | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
744 In turn, `feedmail-spray-this-address' is temporarily set to each address |
22609 | 745 \(stripped of any comments and angle brackets\) and calls a function which |
746 fiddles message headers according to this variable. See the documentation for | |
747 `feedmail-fiddle-plex-blurb', for an overview of fiddle-plex data structures. | |
22513 | 748 |
749 May be nil, in which case nothing in particular is done about message | |
750 headers for specific addresses. | |
751 | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
752 May be t, in which case a \"To:\" header is added to the message with |
22513 | 753 the stripped address as the header contents. The fiddle-plex operator |
754 is 'supplement. | |
755 | |
756 May be a string, in which case the string is assumed to be the name of | |
757 a message header field with the stripped address serving as the value. | |
758 The fiddle-plex operator is 'supplement. | |
759 | |
760 May be a function, in which case it is called with no arguments and is | |
761 expected to return nil, t, a string, another function, or a fiddle-plex. | |
762 The result is used recursively. | |
763 | |
764 May be a list of any combination of the foregoing and fiddle-plexes. (A | |
765 value for this variable which consists of a single fiddle-plex must be | |
766 nested inside another list to avoid ambiguity.) If a list, each item | |
767 is acted on in turn as described above. | |
768 | |
769 For example, | |
770 | |
771 (setq feedmail-spray-address-fiddle-plex-list 'my-address-embellisher) | |
772 | |
773 The idea of the example is that, during spray mode, as each message is | |
774 about to be transmitted to an individual address, the function will be | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
775 called and will consult `feedmail-spray-this-address' to find the |
22513 | 776 stripped envelope email address (no comments or angle brackets). The |
777 function should return an embellished form of the address. | |
778 | |
779 The recipe for sending form letters is: (1) create a message with all | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
780 addressees on Bcc: headers; (2) tell feedmail to remove Bcc: headers |
22609 | 781 before sending the message; (3) create a function which will embellish |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
782 stripped addresses, if desired; (4) define `feedmail-spray-address-fiddle-plex-list' |
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
783 appropriately; (5) send the message with `feedmail-enable-spray' set |
22513 | 784 non-nil; (6) stand back and watch co-workers wonder at how efficient |
785 you are at accomplishing inherently inefficient things." | |
786 :group 'feedmail-spray | |
23265
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
787 :type 'sexp ; too complex to be described accurately |
22513 | 788 ) |
789 | |
790 | |
791 (defcustom feedmail-enable-queue nil | |
792 "*If non-nil, provide for stashing outgoing messages in a queue. | |
793 This is the master on/off switch for feedmail message queuing. | |
794 Queuing is quite handy for laptop-based users. It's also handy if you | |
795 get a lot of mail and process it more or less sequentially. For | |
796 example, you might change your mind about contents of a reply based on | |
797 a message you see a bit later. | |
798 | |
799 There is a separate queue for draft messages, intended to prevent | |
800 you from accidentally sending incomplete messages. The queues are | |
801 disk-based and intended for later transmission. The messages are | |
802 queued in their raw state as they appear in the mail-mode buffer and | |
803 can be arbitrarily edited later, before sending, by visiting the | |
804 appropriate file in the queue directory (and setting the buffer to | |
805 mail-mode or whatever). If you visit a file in the queue directory | |
806 and try to queue it again, it will just get saved in its existing file | |
807 name. You can move a message from the draft to the main queue or vice | |
808 versa by pretending to send it and then selecting whichever queue | |
809 directory you want at the prompt. The right thing will happen. | |
810 | |
811 To transmit all the messages in the queue, invoke the command | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
812 `feedmail-run-the-queue' or `feedmail-run-the-queue-no-prompts'." |
22513 | 813 :group 'feedmail-queue |
814 :type 'boolean | |
22799 | 815 ) |
22513 | 816 |
817 | |
818 (defcustom feedmail-queue-runner-confirm-global nil | |
819 "*If non-nil, give a y-or-n confirmation prompt before running the queue. | |
820 Prompt even if the queue is about to be processed as a result of a call to | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
821 `feedmail-run-the-queue-no-prompts'. This gives you a way to bail out |
22513 | 822 without having to answer no to the individual message prompts." |
823 :group 'feedmail-queue | |
824 :type 'boolean) | |
825 | |
826 | |
827 ;; I provided a default for VMS because someone asked for it (the | |
828 ;; normal default doesn't work there), but, puh-lease!, it is a user | |
829 ;; definable option, so if you don't like the default, change it to | |
830 ;; whatever you want. I am unable to directly test the VMS goop | |
831 ;; provided here by levitte@lp.se (Richard Levitte - VMS Whacker). | |
832 (defcustom feedmail-queue-directory | |
833 (if (memq system-type '(axp-vms vax-vms)) | |
834 (expand-file-name (concat (getenv "HOME") "[.MAIL.Q]")) | |
22799 | 835 (concat (getenv "HOME") "/mail/q")) |
22513 | 836 "*Name of a directory where messages will be queued. |
837 Directory will be created if necessary. Should be a string that | |
838 doesn't end with a slash. Default, except on VMS, is \"$HOME/mail/q\"." | |
839 :group 'feedmail-queue | |
840 :type 'string | |
22799 | 841 ) |
22513 | 842 |
843 | |
844 (defcustom feedmail-queue-draft-directory | |
845 (if (memq system-type '(axp-vms vax-vms)) | |
846 (expand-file-name (concat (getenv "HOME") "[.MAIL.DRAFT]")) | |
22799 | 847 (concat (getenv "HOME") "/mail/draft")) |
47926
5e18e835d9fa
(feedmail-nuke-body-in-fcc, feedmail-queue-draft-directory): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
42787
diff
changeset
|
848 "*Name of a directory where draft messages will be queued. |
22513 | 849 Directory will be created if necessary. Should be a string that |
850 doesn't end with a slash. Default, except on VMS, is \"$HOME/mail/draft\"." | |
851 :group 'feedmail-queue | |
852 :type 'string | |
22799 | 853 ) |
22513 | 854 |
855 | |
856 (defcustom feedmail-ask-before-queue t | |
857 "*If non-nil, feedmail will ask what you want to do with the message. | |
858 Default choices for the message action prompt will include sending it | |
859 immediately, putting it in the main queue, putting it in the draft | |
860 queue, or returning to the buffer to continue editing. Only matters if | |
861 queuing is enabled. If nil, the message is placed in the main queue | |
862 without a prompt." | |
863 :group 'feedmail-queue | |
864 :type 'boolean | |
22799 | 865 ) |
22513 | 866 |
867 | |
868 (defcustom feedmail-ask-before-queue-prompt "FQM: Message action (q, i, d, e, ?)? [%s]: " | |
869 "*A string which will be used for the message action prompt. | |
870 If it contains a \"%s\", that will be replaced with the value of | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
871 `feedmail-ask-before-queue-default'." |
22513 | 872 :group 'feedmail-queue |
873 :type 'string | |
22799 | 874 ) |
22513 | 875 |
876 | |
877 (defcustom feedmail-ask-before-queue-reprompt "FQM: Please type q, i, d, or e; or ? for help [%s]: " | |
878 "*A string which will be used for repompting after invalid input. | |
879 If it contains a \"%s\", that will be replaced with the value of | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
880 `feedmail-ask-before-queue-default'." |
22513 | 881 :group 'feedmail-queue |
882 :type 'string | |
22799 | 883 ) |
22513 | 884 |
885 | |
886 (defcustom feedmail-ask-before-queue-default "queue" | |
887 "*Meaning if user hits return in response to the message action prompt. | |
888 Should be a character or a string; if a string, only the first | |
889 character is significant. Useful values are those described in | |
890 the help for the message action prompt." | |
891 :group 'feedmail-queue | |
22799 | 892 :type '(choice string integer) ;use integer to get char |
893 ) | |
22513 | 894 |
895 | |
896 (defvar feedmail-prompt-before-queue-standard-alist | |
897 '((?q . feedmail-message-action-queue) | |
22799 | 898 (?Q . feedmail-message-action-queue-strong) |
22513 | 899 |
22799 | 900 (?d . feedmail-message-action-draft) |
901 (?r . feedmail-message-action-draft) | |
902 (?D . feedmail-message-action-draft-strong) | |
903 (?R . feedmail-message-action-draft-strong) | |
22513 | 904 |
22799 | 905 (?e . feedmail-message-action-edit) |
906 (?E . feedmail-message-action-edit) | |
907 (?\C-g . feedmail-message-action-edit) | |
908 (?n . feedmail-message-action-edit) | |
909 (?N . feedmail-message-action-edit) | |
22513 | 910 |
22799 | 911 (?i . feedmail-message-action-send) |
912 (?I . feedmail-message-action-send-strong) | |
913 (?s . feedmail-message-action-send) | |
914 (?S . feedmail-message-action-send-strong) | |
22513 | 915 |
22799 | 916 (?* . feedmail-message-action-toggle-spray) |
22513 | 917 |
22799 | 918 (?\C-v . feedmail-message-action-help) |
919 (?? . feedmail-message-action-help)) | |
22513 | 920 "An alist of choices for the message action prompt. |
921 All of the values are function names, except help, which is a special | |
922 symbol that calls up help for the prompt (the help describes the | |
923 actions from the standard alist). To customize your own choices, | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
924 define a similar alist called `feedmail-prompt-before-queue-user-alist'. |
22513 | 925 The actual alist used for message action will be the standard alist |
926 overlaid with the user-alist. To neutralize an item in the standard | |
927 alist without providing a replacement, define an appropriate element | |
928 in the user alist with a value of nil." ) | |
929 | |
930 | |
931 (defcustom feedmail-prompt-before-queue-user-alist nil | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
932 "See `feedmail-prompt-before-queue-standard-alist'." |
22513 | 933 :group 'feedmail-queue |
23265
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
934 :type '(repeat (cons character function)) |
22513 | 935 ) |
936 | |
937 | |
938 (defcustom feedmail-prompt-before-queue-help-supplement nil | |
939 "User-provided supplementary help string for the message action prompt. | |
940 When the message action prompt is shown, the user can as for verbose help, | |
941 at which point a buffer pops up describing the meaning of possible | |
942 responses to the prompt. Through various customizations (see, for | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
943 example, `feedmail-prompt-before-queue-user-alist'), the available responses |
22513 | 944 and the prompt itself can be changed. If this variable is set to a string |
945 value, that string is written to the help buffer after the standard info. | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
946 It may contain embedded line breaks. It will be printed via `princ'." |
22513 | 947 :group 'feedmail-queue |
23265
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
948 :type '(choice (const nil) string) |
22513 | 949 ) |
950 | |
951 | |
952 (defcustom feedmail-queue-reminder-alist | |
953 '((after-immediate . feedmail-queue-reminder-brief) | |
22799 | 954 (after-queue . feedmail-queue-reminder-medium) |
955 (after-draft . feedmail-queue-reminder-medium) | |
956 (after-run . feedmail-queue-reminder-brief) | |
957 (on-demand . feedmail-run-the-queue-global-prompt)) | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
958 "See `feedmail-queue-reminder'." |
22513 | 959 :group 'feedmail-queue |
23265
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
960 :type '(repeat (cons (choice :tag "Event" |
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
961 (const on-demand) |
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
962 (const after-immediate) |
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
963 (const after-queue) |
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
964 (const after-draft) |
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
965 (const after-run)) |
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
966 function)) |
22513 | 967 ) |
968 | |
969 | |
970 (defcustom feedmail-queue-chatty t | |
971 "*If non-nil, blat a few status messages and such in the mini-buffer. | |
972 If nil, just do the work and don't pester people about what's going on. | |
973 In some cases, though, specific options inspire mini-buffer prompting. | |
974 That's not affected by this variable setting. Also does not control | |
975 reporting of error/abnormal conditions." | |
976 :group 'feedmail-queue | |
977 :type 'boolean | |
22799 | 978 ) |
22513 | 979 |
980 | |
981 (defcustom feedmail-queue-chatty-sit-for 2 | |
982 "*Duration of pause after most queue-related messages. | |
983 After some messages are divulged, it is prudent to pause before | |
984 something else obliterates them. This value controls the duration of | |
985 the pause." | |
986 :group 'feedmail-queue | |
987 :type 'integer | |
22799 | 988 ) |
22513 | 989 |
990 | |
991 (defcustom feedmail-queue-run-orderer nil | |
992 "*If non-nil, name a function which will sort the queued messages. | |
993 The function is called during a running of the queue for sending, and | |
994 takes one argument, a list of the files in the queue directory. It | |
995 may contain the names of non-message files, and it's okay to leave | |
996 them in the list when reordering it; they get skipped over later. | |
997 When nil, the default action processes the messages in normal sort | |
998 order by queued file name, which will typically result in the order | |
999 they were placed in the queue." | |
1000 :group 'feedmail-queue | |
1001 :type '(choice (const nil) function) | |
22799 | 1002 ) |
22513 | 1003 |
1004 | |
1005 (defcustom feedmail-queue-use-send-time-for-date nil | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1006 "*If non-nil, use send time for the Date: header value. |
22513 | 1007 This variable is used by the default date generating function, |
1008 feedmail-default-date-generator. If nil, the default, the | |
1009 last-modified timestamp of the queue file is used to create the | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1010 message Date: header; if there is no queue file, the current time is |
22513 | 1011 used." |
1012 :group 'feedmail-queue | |
1013 :type 'boolean | |
22799 | 1014 ) |
22513 | 1015 |
1016 | |
1017 (defcustom feedmail-queue-use-send-time-for-message-id nil | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1018 "*If non-nil, use send time for the Message-Id: header value. |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1019 This variable is used by the default Message-Id: generating function, |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1020 `feedmail-default-message-id-generator'. If nil, the default, the |
22513 | 1021 last-modified timestamp of the queue file is used to create the |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1022 message Message-Id: header; if there is no queue file, the current time is |
22513 | 1023 used." |
1024 :group 'feedmail-queue | |
1025 :type 'boolean | |
22799 | 1026 ) |
22513 | 1027 |
1028 | |
1029 (defcustom feedmail-ask-for-queue-slug nil | |
1030 "*If non-nil, prompt user for part of the queue file name. | |
1031 The file will automatically get the FQM suffix and an embedded | |
1032 sequence number for uniqueness, so don't specify that. feedmail will | |
1033 get rid of all characters other than alphanumeric and hyphen in the | |
1034 results. If this variable is nil or if you just hit return in | |
1035 response to the prompt, feedmail queuing will take care of things | |
1036 properly. At the prompt, completion is available if you want to see | |
1037 what filenames are already in use, though, as noted, you will not be | |
1038 typing a complete file name. You probably don't want to be bothered | |
1039 with this prompting since feedmail, by default, uses queue file names | |
1040 based on the subjects of the messages." | |
1041 :group 'feedmail-queue | |
1042 :type 'boolean | |
22799 | 1043 ) |
22513 | 1044 |
1045 | |
1046 (defcustom feedmail-queue-slug-maker 'feedmail-queue-subject-slug-maker | |
1047 "*If non-nil, a function which creates part of the queued file name. | |
1048 Takes a single argument giving the name of the directory into | |
1049 which the message will be queued. The returned string should be just | |
1050 the non-directory filename part, without FQM suffix or uniquifying | |
1051 sequence numbers. The current buffer holds the raw message. The | |
1052 default function creates the slug based on the message subject, if | |
1053 any." | |
1054 :group 'feedmail-queue | |
1055 :type '(choice (const nil) function) | |
22799 | 1056 ) |
22513 | 1057 |
1058 | |
1059 (defcustom feedmail-queue-default-file-slug t | |
1060 "*Indicates what to use for subject-less messages when forming a file name. | |
22609 | 1061 When feedmail queues a message, it creates a unique file name. By default, |
22513 | 1062 the file name is based in part on the subject of the message being queued. |
1063 If there is no subject, consult this variable. See documentation for the | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1064 function `feedmail-queue-subject-slug-maker'. |
22513 | 1065 |
1066 If t, an innocuous default is used. | |
1067 | |
1068 If a string, it is used directly. | |
1069 | |
1070 If a function, it is called with no arguments from the buffer containing the raw | |
1071 text of the message. It must return a string (which may be empty). | |
1072 | |
1073 If the symbol 'ask, you will be prompted for a string in the mini-buffer. | |
1074 Filename completion is available so that you can inspect what's already been | |
1075 used, but feedmail will do further manipulation on the string you return, so | |
1076 it's not expected to be a complete filename." | |
1077 :group 'feedmail-queue | |
23265
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
1078 :type '(choice (const :tag "Default" t) string function (const ask)) |
22799 | 1079 ) |
22513 | 1080 |
1081 | |
1082 (defcustom feedmail-queue-fqm-suffix ".fqm" | |
1083 "*The FQM suffix used to distinguish feedmail queued message files. | |
1084 You probably want this to be a period followed by some letters and/or | |
1085 digits. The distinction is to be able to tell them from other random | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1086 files that happen to be in the `feedmail-queue-directory' or |
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1087 `feedmail-queue-draft-directory'. By the way, FQM stands for feedmail |
22513 | 1088 queued message." |
1089 :group 'feedmail-queue | |
1090 :type 'string | |
22799 | 1091 ) |
22513 | 1092 |
1093 | |
1094 (defcustom feedmail-nuke-buffer-after-queue nil | |
1095 "*If non-nil, silently kill the buffer after a message is queued. | |
1096 You might like that since a side-effect of queueing the message is | |
1097 that its buffer name gets changed to the filename. That means that | |
1098 the buffer won't be reused for the next message you compose. If you | |
1099 are using VM for creating messages, you probably want to leave this | |
1100 nil, since VM has its own options for managing the recycling of | |
1101 message buffers." | |
1102 :group 'feedmail-queue | |
1103 :type 'boolean | |
22799 | 1104 ) |
22513 | 1105 |
1106 | |
1107 (defcustom feedmail-queue-auto-file-nuke nil | |
1108 "*If non-nil, automatically delete queue files when a message is sent. | |
1109 Normally, feedmail will notice such files when you send a message in | |
1110 immediate mode (i.e., not when you're running the queue) and will ask if | |
1111 you want to delete them. Since the answer is usually yes, setting this | |
22609 | 1112 variable to non-nil will tell feedmail to skip the prompt and just delete |
22513 | 1113 the file without bothering you." |
1114 :group 'feedmail-queue | |
1115 :type 'boolean | |
22799 | 1116 ) |
22513 | 1117 |
1118 | |
1119 ;; defvars to make byte-compiler happy(er) | |
22609 | 1120 (defvar feedmail-error-buffer nil) |
1121 (defvar feedmail-prepped-text-buffer nil) | |
1122 (defvar feedmail-raw-text-buffer nil) | |
1123 (defvar feedmail-address-list nil) | |
22513 | 1124 |
1125 | |
23409
b9c1f9b1dac9
(feedmail-queue-runner-is-active): Definition moved.
Richard M. Stallman <rms@gnu.org>
parents:
23265
diff
changeset
|
1126 (defvar feedmail-queue-runner-is-active nil |
b9c1f9b1dac9
(feedmail-queue-runner-is-active): Definition moved.
Richard M. Stallman <rms@gnu.org>
parents:
23265
diff
changeset
|
1127 "*Non-nil means we're inside the logic of the queue-running loop. |
b9c1f9b1dac9
(feedmail-queue-runner-is-active): Definition moved.
Richard M. Stallman <rms@gnu.org>
parents:
23265
diff
changeset
|
1128 That is, iterating over all messages in the queue to send them. In |
b9c1f9b1dac9
(feedmail-queue-runner-is-active): Definition moved.
Richard M. Stallman <rms@gnu.org>
parents:
23265
diff
changeset
|
1129 that case, the value is the name of the queued message file currently |
b9c1f9b1dac9
(feedmail-queue-runner-is-active): Definition moved.
Richard M. Stallman <rms@gnu.org>
parents:
23265
diff
changeset
|
1130 being processed. This can be used for differentiating customized code |
b9c1f9b1dac9
(feedmail-queue-runner-is-active): Definition moved.
Richard M. Stallman <rms@gnu.org>
parents:
23265
diff
changeset
|
1131 for different scenarios. Users shouldn't set or change this |
b9c1f9b1dac9
(feedmail-queue-runner-is-active): Definition moved.
Richard M. Stallman <rms@gnu.org>
parents:
23265
diff
changeset
|
1132 variable, but may depend on its value as described here.") |
b9c1f9b1dac9
(feedmail-queue-runner-is-active): Definition moved.
Richard M. Stallman <rms@gnu.org>
parents:
23265
diff
changeset
|
1133 |
b9c1f9b1dac9
(feedmail-queue-runner-is-active): Definition moved.
Richard M. Stallman <rms@gnu.org>
parents:
23265
diff
changeset
|
1134 |
22513 | 1135 (defun feedmail-mail-send-hook-splitter () |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1136 "Facilitate dividing `mail-send-hook' things into queued and immediate cases. |
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1137 If you have `mail-send-hook' functions that should only be called for sending/ |
22513 | 1138 queueing messages or only be called for the sending of queued messages, this is |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1139 for you. Add this function to `mail-send-hook' with something like this: |
22513 | 1140 |
1141 (add-hook 'mail-send-hook 'feedmail-mail-send-hook-splitter) | |
1142 | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1143 Then add the functions you want called to either `feedmail-mail-send-hook-queued' |
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1144 or `feedmail-mail-send-hook', as apprpriate. The distinction is that |
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1145 `feedmail-mail-send-hook' will be called when you send mail from a composition |
22513 | 1146 buffer (typically by typing C-c C-c), whether the message is sent immediately |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1147 or placed in the queue or drafts directory. `feedmail-mail-send-hook-queued' is |
22513 | 1148 called when messages are being sent from the queue directory, typically via a |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1149 call to `feedmail-run-the-queue'." |
22513 | 1150 (if feedmail-queue-runner-is-active |
22799 | 1151 (run-hooks 'feedmail-mail-send-hook-queued) |
1152 (run-hooks 'feedmail-mail-send-hook)) | |
1153 ) | |
22513 | 1154 |
1155 | |
1156 (defvar feedmail-mail-send-hook nil | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1157 "*See documentation for `feedmail-mail-send-hook-splitter'.") |
22513 | 1158 |
1159 | |
1160 (defvar feedmail-mail-send-hook-queued nil | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1161 "*See documentation for `feedmail-mail-send-hook-splitter'.") |
22513 | 1162 |
1163 | |
1164 (defun feedmail-confirm-addresses-hook-example () | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1165 "An example of a `feedmail-last-chance-hook'. |
22513 | 1166 It shows the simple addresses and gets a confirmation. Use as: |
1167 (setq feedmail-last-chance-hook 'feedmail-confirm-addresses-hook-example)." | |
1168 (save-window-excursion | |
22799 | 1169 (display-buffer (set-buffer (get-buffer-create " F-C-A-H-E"))) |
1170 (erase-buffer) | |
1171 (insert (mapconcat 'identity feedmail-address-list " ")) | |
1172 (if (not (y-or-n-p "How do you like them apples? ")) | |
1173 (error "FQM: Sending...gave up in last chance hook") | |
1174 ))) | |
22513 | 1175 |
1176 | |
1177 (defcustom feedmail-last-chance-hook nil | |
1178 "*User's last opportunity to modify the message on its way out. | |
1179 It has already had all the header prepping from the standard package. | |
1180 The next step after running the hook will be to push the buffer into a | |
1181 subprocess that mails the mail. The hook might be interested in | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1182 these: (1) `feedmail-prepped-text-buffer' contains the header and body |
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1183 of the message, ready to go; (2) `feedmail-address-list' contains a list |
22513 | 1184 of simplified recipients of addresses which are to be given to the |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1185 subprocess (the hook may change the list); (3) `feedmail-error-buffer' |
22513 | 1186 is an empty buffer intended to soak up errors for display to the user. |
1187 If the hook allows interactive activity, the user should not send more | |
1188 mail while in the hook since some of the internal buffers will be | |
1189 reused and things will get confused." | |
1190 :group 'feedmail-misc | |
1191 :type 'hook | |
22799 | 1192 ) |
22513 | 1193 |
1194 | |
1195 (defcustom feedmail-before-fcc-hook nil | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1196 "*User's last opportunity to modify the message before Fcc action. |
22513 | 1197 It has already had all the header prepping from the standard package. |
1198 The next step after running the hook will be to save the message via | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1199 Fcc: processing. The hook might be interested in these: (1) |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1200 `feedmail-prepped-text-buffer' contains the header and body of the |
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1201 message, ready to go; (2) `feedmail-address-list' contains a list of |
22513 | 1202 simplified recipients of addressees to whom the message was sent (3) |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1203 `feedmail-error-buffer' is an empty buffer intended to soak up errors |
22513 | 1204 for display to the user. If the hook allows interactive activity, the |
1205 user should not send more mail while in the hook since some of the | |
1206 internal buffers will be reused and things will get confused." | |
1207 :group 'feedmail-misc | |
1208 :type 'hook | |
22799 | 1209 ) |
22513 | 1210 |
1211 (defcustom feedmail-queue-runner-mode-setter | |
1212 '(lambda (&optional arg) (mail-mode)) | |
22609 | 1213 "*A function to set the proper mode of a message file. |
1214 Called when the message is read back out of the queue directory with a single | |
22513 | 1215 argument, the optional argument used in the call to |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1216 `feedmail-run-the-queue' or `feedmail-run-the-queue-no-prompts'. |
22513 | 1217 |
22609 | 1218 Most people want `mail-mode', so the default value is an anonymous |
22513 | 1219 function which is just a wrapper to ignore the supplied argument when |
1220 calling it, but here's your chance to have something different. | |
22609 | 1221 Called with funcall, not `call-interactively'." |
22513 | 1222 :group 'feedmail-queue |
1223 :type 'function | |
22799 | 1224 ) |
22513 | 1225 |
1226 | |
1227 (defcustom feedmail-queue-alternative-mail-header-separator nil | |
1228 "*Alternative header demarcation for queued messages. | |
22609 | 1229 If you sometimes get alternative values for `mail-header-separator' in |
22513 | 1230 queued messages, set the value of this variable to whatever it is. |
22609 | 1231 For example, `rmail-resend' uses a `mail-header-separator' value of empty |
22513 | 1232 string (\"\") when you send/queue a message. |
1233 | |
1234 When trying to send a queued message, if the value of this variable is | |
1235 non-nil, feedmail will first try to send the message using the value | |
22609 | 1236 of `mail-header-separator'. If it can't find that, it will temporarily |
1237 set `mail-header-separator' to the value of | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1238 `feedmail-queue-alternative-mail-header-separator' and try again." |
22513 | 1239 :group 'feedmail-queue |
23265
92177ff080cc
(feedmail-x-mailer-line-user-appendage,
Andreas Schwab <schwab@suse.de>
parents:
23222
diff
changeset
|
1240 :type '(choice (const nil) string) |
22799 | 1241 ) |
22513 | 1242 |
1243 | |
1244 (defcustom feedmail-queue-runner-message-sender 'mail-send-and-exit | |
1245 "*Function to initiate sending a message file. | |
1246 Called for each message read back out of the queue directory with a | |
1247 single argument, the optional argument used in the call to | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1248 `feedmail-run-the-queue' or `feedmail-run-the-queue-no-prompts'. |
22513 | 1249 Interactively, that argument will be the prefix argument. Most people |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1250 want `mail-send-and-exit' (bound to C-c C-c in mail-mode), but here's |
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1251 your chance to have something different. Called with `funcall', not |
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1252 `call-interactively'." |
22513 | 1253 :group 'feedmail-queue |
1254 :type 'function | |
22799 | 1255 ) |
22513 | 1256 |
1257 | |
1258 (defcustom feedmail-queue-runner-cleaner-upper | |
1259 '(lambda (fqm-file &optional arg) | |
22799 | 1260 (delete-file fqm-file) |
1261 (if (and arg feedmail-queue-chatty) (message "FQM: Nuked %s" fqm-file))) | |
22609 | 1262 "*Function that will be called after a message has been sent. |
1263 Not called in the case of errors. This function is called with two | |
1264 arguments: the name of the message queue file for the message just sent, | |
1265 and the optional argument used in the call to `feedmail-run-the-queue' | |
1266 or `feedmail-run-the-queue-no-prompts' (prefix arg if interactive). | |
1267 In any case, the affiliated buffer is killed elsewhere, so don't do that | |
22513 | 1268 inside this function. Return value is ignored. |
1269 | |
1270 The default action is an anonymous function which gets rid of the file | |
1271 from the queue directory. With a non-nil second argument, a brief | |
1272 message is give for each file deleted. You could replace this | |
1273 function, for example, to archive all of your sent messages someplace | |
22609 | 1274 \(though there are better ways to get that particular result\)." |
22513 | 1275 :group 'feedmail-queue |
1276 :type 'function | |
22799 | 1277 ) |
22513 | 1278 |
1279 | |
1280 (defvar feedmail-is-a-resend nil | |
42706 | 1281 "*Non-nil means the message is a Resend (in the RFC-822 sense). |
22513 | 1282 This affects the composition of certain headers. feedmail sets this |
1283 variable as soon as it starts prepping the message text buffer, so any | |
1284 user-supplied functions can rely on it. Users shouldn't set or change this | |
1285 variable, but may depend on its value as described here.") | |
1286 | |
1287 | |
1288 (defcustom feedmail-buffer-eating-function 'feedmail-buffer-to-binmail | |
1289 "*Function used to send the prepped buffer to a subprocess. | |
1290 The function's three (mandatory) arguments are: (1) the buffer | |
1291 containing the prepped message; (2) a buffer where errors should be | |
1292 directed; and (3) a list containing the addresses individually as | |
1293 strings. Three popular choices for this are | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1294 `feedmail-buffer-to-binmail', `feedmail-buffer-to-smtpmail', and |
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1295 `feedmail-buffer-to-sendmail'. If you use the sendmail form, you |
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1296 probably want to set `feedmail-nuke-bcc' and/or `feedmail-nuke-resent-bcc' |
22513 | 1297 to nil. If you use the binmail form, check the value of |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1298 `feedmail-binmail-template'." |
22513 | 1299 :group 'feedmail-misc |
1300 :type 'function | |
22799 | 1301 ) |
22513 | 1302 |
1303 | |
1304 (defcustom feedmail-binmail-template (if mail-interactive "/bin/mail %s" "/bin/rmail %s") | |
1305 "*Command template for the subprocess which will get rid of the mail. | |
1306 It can result in any command understandable by /bin/sh. Might not | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1307 work at all in non-Unix environments. The single '%s', if present, |
22513 | 1308 gets replaced by the space-separated, simplified list of addressees. |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1309 Used in `feedmail-buffer-to-binmail' to form the shell command which |
22513 | 1310 will receive the contents of the prepped buffer as stdin. If you'd |
1311 like your errors to come back as mail instead of immediately in a | |
1312 buffer, try /bin/rmail instead of /bin/mail (this can be accomplished | |
22609 | 1313 by keeping the default nil setting of `mail-interactive'). You might |
22513 | 1314 also like to consult local mail experts for any other interesting |
1315 command line possibilities." | |
1316 :group 'feedmail-misc | |
1317 :type 'string | |
22799 | 1318 ) |
22513 | 1319 |
1320 | |
1321 ;; feedmail-buffer-to-binmail, feedmail-buffer-to-sendmail, and | |
1322 ;; feedmail-buffer-to-smptmail are the only things provided for values | |
1323 ;; for the variable feedmail-buffer-eating-function. It's pretty easy | |
1324 ;; to write your own, though. | |
1325 (defun feedmail-buffer-to-binmail (prepped errors-to addr-listoid) | |
1326 "Function which actually calls /bin/mail as a subprocess. | |
1327 Feeds the buffer to it." | |
1328 (set-buffer prepped) | |
1329 (apply | |
1330 'call-process-region | |
1331 (append (list (point-min) (point-max) "/bin/sh" nil errors-to nil "-c" | |
22799 | 1332 (format feedmail-binmail-template |
1333 (mapconcat 'identity addr-listoid " ")))))) | |
22513 | 1334 |
1335 | |
1336 (defun feedmail-buffer-to-sendmail (prepped errors-to addr-listoid) | |
1337 "Function which actually calls sendmail as a subprocess. | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1338 Feeds the buffer to it. Probably has some flaws for Resent-* and other |
22513 | 1339 complicated cases." |
1340 (set-buffer prepped) | |
1341 (apply 'call-process-region | |
22799 | 1342 (append (list (point-min) (point-max) |
72635
e4183d5068ec
* mail/feedmail.el (feedmail-buffer-to-sendmail): Look for
Chong Yidong <cyd@stupidchicken.com>
parents:
66668
diff
changeset
|
1343 (cond ((boundp 'sendmail-program) |
e4183d5068ec
* mail/feedmail.el (feedmail-buffer-to-sendmail): Look for
Chong Yidong <cyd@stupidchicken.com>
parents:
66668
diff
changeset
|
1344 sendmail-program) |
e4183d5068ec
* mail/feedmail.el (feedmail-buffer-to-sendmail): Look for
Chong Yidong <cyd@stupidchicken.com>
parents:
66668
diff
changeset
|
1345 ((file-exists-p "/usr/sbin/sendmail") |
e4183d5068ec
* mail/feedmail.el (feedmail-buffer-to-sendmail): Look for
Chong Yidong <cyd@stupidchicken.com>
parents:
66668
diff
changeset
|
1346 "/usr/sbin/sendmail") |
e4183d5068ec
* mail/feedmail.el (feedmail-buffer-to-sendmail): Look for
Chong Yidong <cyd@stupidchicken.com>
parents:
66668
diff
changeset
|
1347 ((file-exists-p "/usr/lib/sendmail") |
e4183d5068ec
* mail/feedmail.el (feedmail-buffer-to-sendmail): Look for
Chong Yidong <cyd@stupidchicken.com>
parents:
66668
diff
changeset
|
1348 "/usr/lib/sendmail") |
e4183d5068ec
* mail/feedmail.el (feedmail-buffer-to-sendmail): Look for
Chong Yidong <cyd@stupidchicken.com>
parents:
66668
diff
changeset
|
1349 ((file-exists-p "/usr/ucblib/sendmail") |
e4183d5068ec
* mail/feedmail.el (feedmail-buffer-to-sendmail): Look for
Chong Yidong <cyd@stupidchicken.com>
parents:
66668
diff
changeset
|
1350 "/usr/ucblib/sendmail") |
e4183d5068ec
* mail/feedmail.el (feedmail-buffer-to-sendmail): Look for
Chong Yidong <cyd@stupidchicken.com>
parents:
66668
diff
changeset
|
1351 (t "fakemail")) |
22799 | 1352 nil errors-to nil "-oi" "-t") |
1353 ;; provide envelope "from" to sendmail; results will vary | |
1354 (list "-f" user-mail-address) | |
1355 ;; These mean "report errors by mail" and "deliver in background". | |
1356 (if (null mail-interactive) '("-oem" "-odb"))))) | |
22513 | 1357 |
1358 ;; provided by jam@austin.asc.slb.com (James A. McLaughlin); | |
1359 ;; simplified by WJC after more feedmail development; | |
1360 ;; idea (but not implementation) of copying smtpmail trace buffer to | |
1361 ;; feedmail error buffer from: | |
1362 ;; Mon 14-Oct-1996; Douglas Gray Stephens | |
1363 ;; modified to insert error for displaying | |
1364 (defun feedmail-buffer-to-smtpmail (prepped errors-to addr-listoid) | |
33984 | 1365 "Function which actually calls `smtpmail-via-smtp' to send buffer as e-mail." |
22513 | 1366 ;; I'm not sure smtpmail.el is careful about the following |
1367 ;; return value, but it also uses it internally, so I will fear | |
1368 ;; no evil. | |
1369 (require 'smtpmail) | |
1370 (if (not (smtpmail-via-smtp addr-listoid prepped)) | |
22799 | 1371 (progn |
1372 (set-buffer errors-to) | |
1373 (insert "Send via smtpmail failed. Probable SMTP protocol error.\n") | |
1374 (insert "Look for details below or in the *Messages* buffer.\n\n") | |
1375 (let ((case-fold-search t) | |
1376 ;; don't be overconfident about the name of the trace buffer | |
1377 (tracer (concat "trace.*smtp.*" (regexp-quote smtpmail-smtp-server)))) | |
1378 (mapcar | |
1379 '(lambda (buffy) | |
1380 (if (string-match tracer (buffer-name buffy)) | |
1381 (progn | |
1382 (insert "SMTP Trace from " (buffer-name buffy) "\n---------------") | |
66668
857eb702a3f1
Use insert-buffer-substring, not insert-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
65797
diff
changeset
|
1383 (insert-buffer-substring buffy) |
22799 | 1384 (insert "\n\n")))) |
1385 (buffer-list)))))) | |
22513 | 1386 |
1387 | |
1388 ;; just a place to park a docstring | |
1389 (defconst feedmail-fiddle-plex-blurb nil | |
22609 | 1390 "A fiddle-plex is a concise way of specifying header field fiddling. |
22513 | 1391 It is a list of up to 4 elements: NAME, VALUE, ACTION, FOLDING. The element |
1392 VALUE can also be a list sometimes. | |
1393 | |
22609 | 1394 NAME is the name of the header field to be fiddled with. Although case |
1395 doesn't matter in looking for headers, case of NAME is preserved when a header | |
1396 is inserted via fiddling. It shouldn't include the trailing colon. | |
22513 | 1397 |
1398 VALUE is either nil, a simple string, a function returning nil or a string, or, | |
22609 | 1399 as described below for ACTION `combine', a list of up to three values. |
22513 | 1400 |
1401 ACTION describes the nature of the fiddling to be done. Possibilities | |
22609 | 1402 for ACTION (default is `supplement'): |
22513 | 1403 |
22609 | 1404 `supplement' Leave other like fields as-is, insert this one. |
22513 | 1405 |
22609 | 1406 `replace' Delete other like fields, if any, and insert this one. |
22513 | 1407 |
22609 | 1408 `create' Insert this one only if no like field exists. |
22513 | 1409 |
22609 | 1410 `combine' Combine aggregate values of like fields with this one. |
22513 | 1411 In this case, VALUE has a special form. It is a list |
1412 of three items: VAL-PRE, VAL-LIKE, and VAL-POST. | |
1413 VAL-PRE and VAL-POST are strings or nil. VAL-LIKE may | |
1414 be either a string or a function (it may also be nil, | |
1415 but there's not much point to that). | |
1416 | |
1417 Values of like header fields are aggregated, leading and | |
1418 trailing whitespace is removed, and embedded | |
1419 whitespace is left as-is. If there are no like | |
1420 fields, or the aggregate value is an empty string, | |
1421 VAL-LIKE is not used. Else, if VAL-LIKE is a function, | |
1422 it is called with two arguments: NAME and the | |
22609 | 1423 aggregate like values. Else, if VAL-LIKE is a string, it is |
22513 | 1424 used as a format string where a single \%s will be |
1425 replaced by the aggregate values of like fields. | |
1426 | |
1427 VAL-PRE, the results of using VAL-LIKE, and VAL-POST | |
1428 are concatenated, and the result, if not nil and not | |
1429 an empty string, is used as the new value for the | |
1430 field. Although this description sounds a bit | |
1431 complicated, the idea is to provide a mechanism for | |
1432 combining the old value with a new value in a flexible | |
1433 way. For example, if you wanted to add a new value to | |
1434 an existing header field by adding a semi-colon and | |
1435 then starting the new value on a continuation line, | |
1436 you might specify this: | |
1437 | |
1438 (nil \"%s;\\n\\t\" \"This is my new value\") | |
1439 | |
1440 FOLDING can be nil, in which case VALUE is used as-is. If FOLDING is | |
1441 non-nil, feedmail \"smart filling\" is done on VALUE just before | |
22609 | 1442 insertion.") |
22513 | 1443 |
33984 | 1444 ;;;###autoload |
22513 | 1445 (defun feedmail-send-it () |
35616 | 1446 "Send the current mail buffer using the Feedmail package. |
1447 This is a suitable value for `send-mail-function'. It can be used | |
1448 with various lower-level mechanisms to provide features such as queueing." | |
22513 | 1449 |
1450 ;; avoid matching trouble over slash vs backslash by getting canonical | |
1451 (if feedmail-queue-directory | |
22799 | 1452 (setq feedmail-queue-directory (expand-file-name feedmail-queue-directory))) |
22513 | 1453 (if feedmail-queue-draft-directory |
22799 | 1454 (setq feedmail-queue-draft-directory (expand-file-name feedmail-queue-draft-directory))) |
22513 | 1455 (if (not feedmail-enable-queue) (feedmail-send-it-immediately) |
22799 | 1456 ;; else, queuing is enabled, should we ask about it or just do it? |
1457 (if feedmail-ask-before-queue | |
1458 (funcall (feedmail-queue-send-edit-prompt)) | |
1459 (feedmail-dump-message-to-queue feedmail-queue-directory 'after-queue)))) | |
22513 | 1460 |
1461 | |
1462 (defun feedmail-message-action-send () | |
1463 ;; hooks can make this take a while so clear the prompt | |
1464 (message "FQM: Immediate send...") | |
1465 (feedmail-send-it-immediately)) | |
1466 | |
1467 | |
1468 ;; From a VM mailing list discussion and some suggestions from Samuel Mikes <smikes@alumni.hmc.edu> | |
1469 (defun feedmail-queue-express-to-queue () | |
1470 "*Send message directly to the queue, with a minimum of fuss and bother." | |
1471 (interactive) | |
1472 (let ((feedmail-enable-queue t) | |
22799 | 1473 (feedmail-ask-before-queue nil) |
1474 (feedmail-queue-reminder-alist nil) | |
1475 (feedmail-queue-chatty-sit-for 0)) | |
1476 (feedmail-send-it) | |
1477 ) | |
1478 ) | |
22513 | 1479 |
1480 | |
1481 (defun feedmail-queue-express-to-draft () | |
1482 "*Send message directly to the draft queue, with a minimum of fuss and bother." | |
1483 (interactive) | |
1484 (let ((feedmail-queue-directory feedmail-queue-draft-directory)) | |
22799 | 1485 (feedmail-queue-express-to-queue) |
1486 ) | |
1487 ) | |
22513 | 1488 |
1489 | |
1490 (defun feedmail-message-action-send-strong () | |
1491 (let ((feedmail-confirm-outgoing nil)) (feedmail-message-action-send))) | |
1492 | |
1493 | |
1494 (defun feedmail-message-action-edit () | |
1495 (error "FQM: Message not queued; returning to edit")) | |
1496 | |
1497 | |
1498 (defun feedmail-message-action-draft () | |
1499 (feedmail-dump-message-to-queue feedmail-queue-draft-directory 'after-draft)) | |
1500 | |
1501 | |
1502 (defun feedmail-message-action-draft-strong () | |
1503 (let ((buffer-file-name nil)) | |
22799 | 1504 (feedmail-message-action-draft))) |
22513 | 1505 |
1506 | |
1507 (defun feedmail-message-action-queue () | |
1508 (feedmail-dump-message-to-queue feedmail-queue-directory 'after-queue)) | |
1509 | |
1510 | |
1511 (defun feedmail-message-action-queue-strong () | |
1512 (let ((buffer-file-name nil)) | |
22799 | 1513 (feedmail-message-action-queue))) |
22513 | 1514 |
1515 | |
1516 (defun feedmail-message-action-toggle-spray () | |
1517 (let ((feedmail-enable-spray (not feedmail-enable-spray))) | |
22799 | 1518 (if feedmail-enable-spray |
1519 (message "FQM: For this message, spray toggled ON") | |
1520 (message "FQM: For this message, spray toggled OFF")) | |
1521 (sit-for 3) | |
1522 ;; recursion, but harmless | |
1523 (feedmail-send-it))) | |
22513 | 1524 |
1525 | |
1526 (defun feedmail-message-action-help () | |
22799 | 1527 (let ((d-string " ")) |
1528 (if (stringp feedmail-ask-before-queue-default) | |
1529 (setq d-string feedmail-ask-before-queue-default) | |
1530 (setq d-string (char-to-string feedmail-ask-before-queue-default))) | |
1531 (feedmail-queue-send-edit-prompt-help d-string) | |
1532 ;; recursive, but no worries (it goes deeper on user action) | |
1533 (feedmail-send-it))) | |
22513 | 1534 |
1535 | |
1536 ;;;###autoload | |
1537 (defun feedmail-run-the-queue-no-prompts (&optional arg) | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1538 "Like `feedmail-run-the-queue', but suppress confirmation prompts." |
22513 | 1539 (interactive "p") |
1540 (let ((feedmail-confirm-outgoing nil)) (feedmail-run-the-queue arg))) | |
1541 | |
1542 ;;;###autoload | |
1543 (defun feedmail-run-the-queue-global-prompt (&optional arg) | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1544 "Like `feedmail-run-the-queue', but with a global confirmation prompt. |
22609 | 1545 This is generally most useful if run non-interactively, since you can |
22513 | 1546 bail out with an appropriate answer to the global confirmation prompt." |
1547 (interactive "p") | |
1548 (let ((feedmail-queue-runner-confirm-global t)) (feedmail-run-the-queue arg))) | |
1549 | |
1550 ;;;###autoload | |
1551 (defun feedmail-run-the-queue (&optional arg) | |
1552 "Visit each message in the feedmail queue directory and send it out. | |
1553 Return value is a list of three things: number of messages sent, number of | |
1554 messages skipped, and number of non-message things in the queue (commonly | |
1555 backup file names and the like)." | |
1556 (interactive "p") | |
1557 ;; avoid matching trouble over slash vs backslash by getting canonical | |
1558 (if feedmail-queue-directory | |
22799 | 1559 (setq feedmail-queue-directory (expand-file-name feedmail-queue-directory))) |
22513 | 1560 (if feedmail-queue-draft-directory |
22799 | 1561 (setq feedmail-queue-draft-directory (expand-file-name feedmail-queue-draft-directory))) |
22513 | 1562 (let* ((maybe-file) |
22799 | 1563 (qlist (feedmail-look-at-queue-directory feedmail-queue-directory)) |
1564 (dlist (feedmail-look-at-queue-directory feedmail-queue-draft-directory)) | |
1565 (q-cnt (nth 0 qlist)) | |
1566 (q-oth (nth 1 qlist)) | |
1567 (d-cnt (nth 0 dlist)) | |
1568 (d-oth (nth 1 dlist)) | |
1569 (messages-sent 0) | |
1570 (messages-skipped 0) | |
1571 (blobby-buffer) | |
1572 (already-buffer) | |
1573 (this-mhsep) | |
1574 (do-the-run t) | |
1575 (list-of-possible-fqms)) | |
1576 (if (and (> q-cnt 0) feedmail-queue-runner-confirm-global) | |
1577 (setq do-the-run | |
1578 (if (fboundp 'y-or-n-p-with-timeout) | |
1579 (y-or-n-p-with-timeout (format "FQM: Draft: %dm+%d, Queue: %dm+%d; run the queue? " | |
1580 d-cnt d-oth q-cnt q-oth) | |
1581 5 nil) | |
1582 (y-or-n-p (format "FQM: Draft: %dm+%d, Queue: %dm+%d; run the queue? " | |
1583 d-cnt d-oth q-cnt q-oth)) | |
1584 ))) | |
1585 (if (not do-the-run) | |
1586 (setq messages-skipped q-cnt) | |
1587 (save-window-excursion | |
1588 (setq list-of-possible-fqms (directory-files feedmail-queue-directory t)) | |
1589 (if feedmail-queue-run-orderer | |
1590 (setq list-of-possible-fqms (funcall feedmail-queue-run-orderer list-of-possible-fqms))) | |
85232 | 1591 (mapc |
22799 | 1592 '(lambda (blobby) |
1593 (setq maybe-file (expand-file-name blobby feedmail-queue-directory)) | |
1594 (cond | |
1595 ((file-directory-p maybe-file) nil) ; don't care about subdirs | |
1596 ((feedmail-fqm-p blobby) | |
1597 (setq blobby-buffer (generate-new-buffer (concat "FQM " blobby))) | |
1598 (setq already-buffer | |
1599 (if (fboundp 'find-buffer-visiting) ; missing from XEmacs | |
1600 (find-buffer-visiting maybe-file) | |
1601 (get-file-buffer maybe-file))) | |
1602 (if (and already-buffer (buffer-modified-p already-buffer)) | |
1603 (save-window-excursion | |
1604 (display-buffer (set-buffer already-buffer)) | |
1605 (if (fboundp 'y-or-n-p-with-timeout) | |
1606 ;; make a guess that the user just forgot to save | |
1607 (if (y-or-n-p-with-timeout (format "FQM: Visiting %s; save before send? " blobby) 10 t) | |
1608 (save-buffer)) | |
1609 (if (y-or-n-p (format "FQM: Visiting %s; save before send? " blobby)) | |
1610 (save-buffer)) | |
1611 ))) | |
1612 | |
1613 (set-buffer blobby-buffer) | |
1614 (setq buffer-offer-save nil) | |
1615 (buffer-disable-undo blobby-buffer) | |
1616 (insert-file-contents-literally maybe-file) | |
22800
125816f37462
(feedmail-queue-send-edit-prompt-help-first):
Karl Heuer <kwzh@gnu.org>
parents:
22799
diff
changeset
|
1617 ;; work around text-vs-binary weirdness and also around rmail-resend's creative |
22799 | 1618 ;; manipulation of mail-header-separator |
1619 ;; | |
1620 ;; if we don't find the normal M-H-S, and the alternative is defined but also | |
1621 ;; not found, try reading the file a different way | |
1622 ;; | |
1623 ;; if M-H-S not found and (a-M-H-S is nil or not found) | |
1624 (if (and (not (feedmail-find-eoh t)) | |
1625 (or (not feedmail-queue-alternative-mail-header-separator) | |
1626 (not | |
1627 (let ((mail-header-separator feedmail-queue-alternative-mail-header-separator)) | |
1628 (feedmail-find-eoh t))))) | |
1629 (let ((file-name-buffer-file-type-alist nil) (default-buffer-file-type nil)) | |
1630 (erase-buffer) (insert-file-contents maybe-file)) | |
1631 ) | |
1632 ;; if M-H-S not found and (a-M-H-S is non-nil and is found) | |
1633 ;; temporarily set M-H-S to the value of a-M-H-S | |
1634 (if (and (not (feedmail-find-eoh t)) | |
1635 feedmail-queue-alternative-mail-header-separator | |
1636 (let ((mail-header-separator feedmail-queue-alternative-mail-header-separator)) | |
1637 (feedmail-find-eoh t))) | |
1638 (setq this-mhsep feedmail-queue-alternative-mail-header-separator) | |
1639 (setq this-mhsep mail-header-separator)) | |
1640 (funcall feedmail-queue-runner-mode-setter arg) | |
1641 (condition-case nil ; don't give up the loop if user skips some | |
1642 (let ((feedmail-enable-queue nil) | |
1643 (mail-header-separator this-mhsep) | |
1644 (feedmail-queue-runner-is-active maybe-file)) | |
1645 (funcall feedmail-queue-runner-message-sender arg) | |
1646 (set-buffer blobby-buffer) | |
1647 (if (buffer-modified-p) ; still modified, means wasn't sent | |
1648 (setq messages-skipped (1+ messages-skipped)) | |
1649 (setq messages-sent (1+ messages-sent)) | |
1650 (funcall feedmail-queue-runner-cleaner-upper maybe-file arg) | |
1651 (if (and already-buffer (not (file-exists-p maybe-file))) | |
1652 ;; we have gotten rid of the file associated with the | |
1653 ;; buffer, so update the buffer's notion of that | |
1654 (save-excursion | |
1655 (set-buffer already-buffer) | |
1656 (setq buffer-file-name nil))))) | |
1657 (error (setq messages-skipped (1+ messages-skipped)))) | |
1658 (kill-buffer blobby-buffer) | |
1659 (if feedmail-queue-chatty | |
1660 (progn | |
1661 (message "FQM: %d to go, %d sent, %d skipped (%d other files ignored)" | |
1662 (- q-cnt messages-sent messages-skipped) | |
1663 messages-sent messages-skipped q-oth) | |
1664 (sit-for feedmail-queue-chatty-sit-for)))))) | |
1665 list-of-possible-fqms))) | |
1666 (if feedmail-queue-chatty | |
1667 (progn | |
1668 (message "FQM: %d sent, %d skipped (%d other files ignored)" | |
1669 messages-sent messages-skipped q-oth) | |
1670 (sit-for feedmail-queue-chatty-sit-for) | |
1671 (feedmail-queue-reminder 'after-run) | |
1672 (sit-for feedmail-queue-chatty-sit-for))) | |
1673 (list messages-sent messages-skipped q-oth))) | |
22513 | 1674 |
1675 | |
1676 ;;;###autoload | |
1677 (defun feedmail-queue-reminder (&optional what-event) | |
1678 "Perform some kind of reminder activity about queued and draft messages. | |
1679 Called with an optional symbol argument which says what kind of event | |
1680 is triggering the reminder activity. The default is 'on-demand, which | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1681 is what you typically would use if you were putting this in your Emacs start-up |
22513 | 1682 or mail hook code. Other recognized values for WHAT-EVENT (these are passed |
1683 internally by feedmail): | |
1684 | |
1685 after-immediate (a message has just been sent in immediate mode) | |
1686 after-queue (a message has just been queued) | |
1687 after-draft (a message has just been placed in the draft directory) | |
1688 after-run (the queue has just been run, possibly sending messages) | |
1689 | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1690 WHAT-EVENT is used as a key into the table `feedmail-queue-reminder-alist'. If |
22513 | 1691 the associated value is a function, it is called without arguments and is expected |
22609 | 1692 to perform the reminder activity. You can supply your own reminder functions |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1693 by redefining `feedmail-queue-reminder-alist'. If you don't want any reminders, |
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1694 you can set `feedmail-queue-reminder-alist' to nil." |
22513 | 1695 (interactive "p") |
1696 (let ((key (if (and what-event (symbolp what-event)) what-event 'on-demand)) entry reminder) | |
22799 | 1697 (setq entry (assoc key feedmail-queue-reminder-alist)) |
1698 (setq reminder (cdr entry)) | |
1699 (if (fboundp reminder) (funcall reminder))) | |
22513 | 1700 ) |
1701 | |
1702 | |
1703 (defun feedmail-queue-reminder-brief () | |
1704 "Brief display of draft and queued message counts in modeline." | |
1705 (interactive) | |
1706 (let (q-cnt d-cnt q-lis d-lis) | |
22799 | 1707 (setq q-lis (feedmail-look-at-queue-directory feedmail-queue-directory)) |
1708 (setq d-lis (feedmail-look-at-queue-directory feedmail-queue-draft-directory)) | |
1709 (setq q-cnt (car q-lis)) | |
1710 (setq d-cnt (car d-lis)) | |
1711 (if (or (> q-cnt 0) (> d-cnt 0)) | |
1712 (progn | |
1713 (message "FQM: [D: %d, Q: %d]" d-cnt q-cnt)))) | |
22513 | 1714 ) |
1715 | |
1716 | |
1717 (defun feedmail-queue-reminder-medium () | |
1718 "Verbose display of draft and queued message counts in modeline." | |
1719 (interactive) | |
1720 (let (q-cnt d-cnt q-oth d-oth q-lis d-lis) | |
22799 | 1721 (setq q-lis (feedmail-look-at-queue-directory feedmail-queue-directory)) |
1722 (setq d-lis (feedmail-look-at-queue-directory feedmail-queue-draft-directory)) | |
1723 (setq q-cnt (car q-lis)) | |
1724 (setq d-cnt (car d-lis)) | |
1725 (setq q-oth (nth 1 q-lis)) | |
1726 (setq d-oth (nth 1 d-lis)) | |
1727 (if (or (> q-cnt 0) (> d-cnt 0)) | |
1728 (progn | |
1729 (message "FQM: Draft: %dm+%d in \"%s\", Queue: %dm+%d in \"%s\"" | |
1730 d-cnt d-oth (file-name-nondirectory feedmail-queue-draft-directory) | |
1731 q-cnt q-oth (file-name-nondirectory feedmail-queue-directory))))) | |
22513 | 1732 ) |
1733 | |
1734 | |
1735 (defun feedmail-queue-send-edit-prompt () | |
1736 "Ask whether to queue, send immediately, or return to editing a message." | |
1737 ;; Some implementation ideas here came from the userlock.el code | |
1738 (discard-input) | |
1739 (save-window-excursion | |
22799 | 1740 (let ((answer) (d-char) (d-string " ")) |
1741 (if (stringp feedmail-ask-before-queue-default) | |
1742 (progn | |
1743 (setq d-char (string-to-char feedmail-ask-before-queue-default)) | |
1744 (setq d-string feedmail-ask-before-queue-default)) | |
1745 (setq d-string (char-to-string feedmail-ask-before-queue-default)) | |
1746 (setq d-char feedmail-ask-before-queue-default) | |
1747 ) | |
22513 | 1748 (while (null answer) |
22799 | 1749 (message feedmail-ask-before-queue-prompt d-string) |
1750 (let ((user-sez | |
1751 (let ((inhibit-quit t) (cursor-in-echo-area t) (echo-keystrokes 0)) | |
1752 (read-char-exclusive)))) | |
1753 (if (= user-sez help-char) | |
1754 (setq answer '(^ . feedmail-message-action-help)) | |
1755 (if (or (eq user-sez ?\C-m) (eq user-sez ?\C-j) (eq user-sez ?y)) | |
1756 (setq user-sez d-char)) | |
1757 ;; these char-to-int things are because of some | |
1758 ;; incomprensible difference between the two in | |
1759 ;; byte-compiled stuff between Emacs and XEmacs | |
1760 ;; (well, I'm sure someone could comprehend it, | |
1761 ;; but I say 'uncle') | |
1762 (setq answer (or (assoc user-sez feedmail-prompt-before-queue-user-alist) | |
1763 (and (fboundp 'char-to-int) | |
1764 (assoc (char-to-int user-sez) feedmail-prompt-before-queue-user-alist)) | |
1765 (assoc user-sez feedmail-prompt-before-queue-standard-alist) | |
1766 (and (fboundp 'char-to-int) | |
1767 (assoc (char-to-int user-sez) feedmail-prompt-before-queue-standard-alist)))) | |
1768 (if (or (null answer) (null (cdr answer))) | |
1769 (progn | |
1770 (beep) | |
1771 (message feedmail-ask-before-queue-reprompt d-string) | |
1772 (sit-for 3))) | |
1773 ))) | |
1774 (cdr answer) | |
1775 ))) | |
22513 | 1776 |
1777 (defconst feedmail-p-h-b-n "*FQM Help*") | |
1778 | |
1779 (defun feedmail-queue-send-edit-prompt-help (d-string) | |
1780 (let ((fqm-help (get-buffer feedmail-p-h-b-n))) | |
39477
7ff02d7c4baf
(feedmail-queue-send-edit-prompt-help):
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
1781 (if (and fqm-help (get-buffer-window fqm-help 'visible)) |
22799 | 1782 (feedmail-queue-send-edit-prompt-help-later fqm-help d-string) |
1783 (feedmail-queue-send-edit-prompt-help-first d-string)))) | |
22513 | 1784 |
1785 (defun feedmail-queue-send-edit-prompt-help-later (fqm-help d-string) | |
1786 ;; scrolling fun | |
1787 (save-selected-window | |
22799 | 1788 (let ((signal-error-on-buffer-boundary nil) |
1789 (fqm-window (display-buffer fqm-help))) | |
1790 (select-window fqm-window) | |
1791 (if (pos-visible-in-window-p (point-max) fqm-window) | |
1792 (feedmail-queue-send-edit-prompt-help-first d-string) | |
1793 ;;(goto-char (point-min)) | |
1794 (scroll-up nil) | |
1795 )))) | |
22513 | 1796 |
1797 (defun feedmail-queue-send-edit-prompt-help-first (d-string) | |
1798 (with-output-to-temp-buffer feedmail-p-h-b-n | |
1799 (princ "You're dispatching a message and feedmail queuing is enabled. | |
1800 Typing ? or C-v will normally scroll this help buffer. | |
1801 | |
1802 Choices: | |
1803 q QUEUE for later sending (via feedmail-run-the-queue) | |
1804 Q QUEUE! like \"q\", but always make a new file | |
1805 i IMMEDIATELY send this (but not the other queued messages) | |
1806 I IMMEDIATELY! like \"i\", but skip following confirmation prompt | |
1807 d DRAFT queue in the draft directory | |
1808 D DRAFT! like \"d\", but always make a new file | |
1809 e EDIT return to the message edit buffer (don't send or queue) | |
1810 * SPRAY toggle spray mode (individual message transmissions) | |
1811 | |
1812 Synonyms: | |
1813 s SEND immediately (same as \"i\") | |
1814 S SEND! immediately (same as \"I\") | |
1815 r ROUGH draft (same as \"d\") | |
22800
125816f37462
(feedmail-queue-send-edit-prompt-help-first):
Karl Heuer <kwzh@gnu.org>
parents:
22799
diff
changeset
|
1816 R ROUGH! draft (same as \"D\") |
22513 | 1817 n NOPE didn't mean it (same as \"e\") |
1818 y YUP do the default behavior (same as \"C-m\") | |
1819 | |
1820 The user-configurable default is currently \"") | |
22799 | 1821 (princ d-string) |
1822 (princ "\". For other possibilities, | |
22513 | 1823 see the variable feedmail-prompt-before-queue-user-alist. |
1824 ") | |
22799 | 1825 (and (stringp feedmail-prompt-before-queue-help-supplement) |
1826 (princ feedmail-prompt-before-queue-help-supplement)) | |
22513 | 1827 (save-excursion (set-buffer standard-output) (if (fboundp 'help-mode) (help-mode))))) |
1828 | |
1829 (defun feedmail-look-at-queue-directory (queue-directory) | |
1830 "Find out some things about a queue directory. | |
1831 Result is a list containing a count of queued messages in the | |
1832 directory, a count of other files in the directory, and a high water | |
1833 mark for prefix sequence numbers. Subdirectories are not included in | |
1834 the counts." | |
1835 (let ((q-cnt 0) (q-oth 0) (high-water 0) (blobbet)) | |
22799 | 1836 ;; iterate, counting things we find along the way in the directory |
1837 (if (file-directory-p queue-directory) | |
85232 | 1838 (mapc |
22799 | 1839 '(lambda (blobby) |
1840 (cond | |
1841 ((file-directory-p blobby) nil) ; don't care about subdirs | |
1842 ((feedmail-fqm-p blobby) | |
1843 (setq blobbet (file-name-nondirectory blobby)) | |
1844 (if (string-match "^[0-9][0-9][0-9]-" blobbet) | |
1845 (let ((water-mark)) | |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
1846 (setq water-mark (string-to-number (substring blobbet 0 3))) |
22799 | 1847 (if (> water-mark high-water) (setq high-water water-mark)))) |
1848 (setq q-cnt (1+ q-cnt))) | |
1849 (t (setq q-oth (1+ q-oth))) | |
1850 )) | |
1851 (directory-files queue-directory t))) | |
1852 (list q-cnt q-oth high-water))) | |
22513 | 1853 |
1854 (defun feedmail-tidy-up-slug (slug) | |
22609 | 1855 "Utility for mapping out suspect characters in a potential filename." |
22513 | 1856 ;; even programmers deserve a break sometimes, so cover nil for them |
1857 (if (null slug) (setq slug "")) | |
1858 ;; replace all non-alphanumerics with hyphen for safety | |
1859 (while (string-match "[^a-z0-9-]+" slug) (setq slug (replace-match "-" nil nil slug))) | |
1860 ;; collapse multiple hyphens to one | |
1861 (while (string-match "--+" slug) (setq slug (replace-match "-" nil nil slug))) | |
1862 ;; for tidyness, peel off leading hyphens | |
1863 (if (string-match "^-*" slug) (setq slug (replace-match "" nil nil slug))) | |
1864 ;; for tidyness, peel off trailing hyphens | |
1865 (if (string-match "-*$" slug) (setq slug (replace-match "" nil nil slug))) | |
1866 slug | |
22799 | 1867 ) |
22513 | 1868 |
1869 (defun feedmail-queue-subject-slug-maker (&optional queue-directory) | |
1870 "Create a name for storing the message in the queue. | |
1871 Optional argument QUEUE-DIRECTORY specifies into which directory the | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1872 file will be placed. The name is based on the Subject: header (if |
22513 | 1873 there is one). If there is no subject, |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
1874 `feedmail-queue-default-file-slug' is consulted. Special characters are |
22513 | 1875 mapped to mostly alphanumerics for safety." |
1876 (let ((eoh-marker) (case-fold-search t) (subject "") (s-point)) | |
22799 | 1877 (setq eoh-marker (feedmail-find-eoh)) |
1878 (goto-char (point-min)) | |
1879 ;; get raw subject value (first line, anyhow) | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1880 (if (re-search-forward "^Subject:" eoh-marker t) |
22799 | 1881 (progn (setq s-point (point)) |
1882 (end-of-line) | |
1883 (setq subject (buffer-substring s-point (point))))) | |
1884 (setq subject (feedmail-tidy-up-slug subject)) | |
1885 (if (zerop (length subject)) | |
1886 (setq subject | |
1887 (cond | |
1888 ((stringp feedmail-queue-default-file-slug) feedmail-queue-default-file-slug) | |
1889 ((fboundp feedmail-queue-default-file-slug) | |
1890 (save-excursion (funcall feedmail-queue-default-file-slug))) | |
1891 ((eq feedmail-queue-default-file-slug 'ask) | |
1892 (file-name-nondirectory | |
1893 (read-file-name "FQM: Message filename slug? " | |
1894 (file-name-as-directory queue-directory) subject nil subject))) | |
1895 (t "no subject")) | |
1896 )) | |
1897 ;; one more time, with feeling | |
1898 (feedmail-tidy-up-slug subject) | |
1899 )) | |
22513 | 1900 |
1901 | |
1902 (defun feedmail-create-queue-filename (queue-directory) | |
1903 (let ((slug "wjc")) | |
22799 | 1904 (cond |
1905 (feedmail-queue-slug-maker | |
1906 (save-excursion (setq slug (funcall feedmail-queue-slug-maker queue-directory)))) | |
1907 (feedmail-ask-for-queue-slug | |
1908 (setq slug (file-name-nondirectory | |
1909 (read-file-name (concat "FQM: Message filename slug? [" slug "]? ") | |
1910 (file-name-as-directory queue-directory) slug nil slug)))) | |
1911 ) | |
1912 (setq slug (feedmail-tidy-up-slug slug)) | |
1913 (setq slug (format "%03d-%s" (1+ (nth 2 (feedmail-look-at-queue-directory queue-directory))) slug)) | |
1914 (concat | |
1915 (expand-file-name slug queue-directory) | |
1916 feedmail-queue-fqm-suffix) | |
1917 )) | |
22513 | 1918 |
1919 | |
1920 (defun feedmail-dump-message-to-queue (queue-directory what-event) | |
1921 (or (file-accessible-directory-p queue-directory) | |
22799 | 1922 ;; progn to get nil result no matter what |
1923 (progn (make-directory queue-directory t) nil) | |
1924 (file-accessible-directory-p queue-directory) | |
1925 (error (concat "FQM: Message not queued; trouble with directory " queue-directory))) | |
22513 | 1926 (let ((filename) |
22799 | 1927 (is-fqm) |
1928 (is-in-this-dir) | |
1929 (previous-buffer-file-name buffer-file-name)) | |
1930 (if buffer-file-name | |
1931 (progn | |
1932 (setq is-fqm (feedmail-fqm-p buffer-file-name)) | |
1933 (setq is-in-this-dir (string-equal | |
1934 (directory-file-name queue-directory) | |
1935 (directory-file-name (expand-file-name (file-name-directory buffer-file-name))))))) | |
1936 ;; if visiting a queued message, just save | |
1937 (if (and is-fqm is-in-this-dir) | |
1938 (setq filename buffer-file-name) | |
1939 (setq filename (feedmail-create-queue-filename queue-directory))) | |
1940 ;; make binary file on DOS/Win95/WinNT, etc | |
1941 (let ((buffer-file-type feedmail-force-binary-write)) (write-file filename)) | |
1942 ;; convenient for moving from draft to q, for example | |
1943 (if (and previous-buffer-file-name (or (not is-fqm) (not is-in-this-dir)) | |
1944 (y-or-n-p (format "FQM: Was previously %s; delete that? " previous-buffer-file-name))) | |
1945 (delete-file previous-buffer-file-name)) | |
1946 (if feedmail-nuke-buffer-after-queue | |
1947 (let ((a-s-file-name buffer-auto-save-file-name)) | |
1948 ;; be aggressive in nuking auto-save files | |
1949 (and (kill-buffer (current-buffer)) | |
1950 delete-auto-save-files | |
1951 (file-exists-p a-s-file-name) | |
1952 (delete-file a-s-file-name)))) | |
1953 (if feedmail-queue-chatty | |
65587
4e6c5e8ae4e9
Message format spec fixes (commit 6)
Deepak Goel <deego@gnufans.org>
parents:
62402
diff
changeset
|
1954 (progn (message "%s" (concat "FQM: Queued in " filename)) |
22799 | 1955 (sit-for feedmail-queue-chatty-sit-for))) |
1956 (if feedmail-queue-chatty | |
1957 (progn | |
1958 (feedmail-queue-reminder what-event) | |
1959 (sit-for feedmail-queue-chatty-sit-for))))) | |
22513 | 1960 |
1961 | |
1962 ;; from a similar function in mail-utils.el | |
1963 (defun feedmail-rfc822-time-zone (time) | |
1964 (let* ((sec (or (car (current-time-zone time)) 0)) | |
22799 | 1965 (absmin (/ (abs sec) 60))) |
22513 | 1966 (format "%c%02d%02d" (if (< sec 0) ?- ?+) (/ absmin 60) (% absmin 60)))) |
1967 | |
1968 (defun feedmail-rfc822-date (arg-time) | |
1969 (let ((time (if arg-time arg-time (current-time)))) | |
22799 | 1970 (concat |
1971 (format-time-string "%a, %e %b %Y %T " time) | |
1972 (feedmail-rfc822-time-zone time) | |
1973 ))) | |
22513 | 1974 |
1975 | |
1976 (defun feedmail-send-it-immediately () | |
1977 "Handle immediate sending, including during a queue run." | |
1978 (let* ((feedmail-error-buffer (get-buffer-create " *FQM Outgoing Email Errors*")) | |
22799 | 1979 (feedmail-prepped-text-buffer (get-buffer-create " *FQM Outgoing Email Text*")) |
1980 (feedmail-raw-text-buffer (current-buffer)) | |
1981 (feedmail-address-list) | |
1982 (eoh-marker) | |
1983 (bcc-holder) | |
1984 (resent-bcc-holder) | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1985 (a-re-rtcb "^Resent-\\(To\\|Cc\\|Bcc\\):") |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1986 (a-re-rtc "^Resent-\\(To\\|Cc\\):") |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1987 (a-re-rb "^Resent-Bcc:") |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1988 (a-re-dtcb "^\\(To\\|Cc\\|Bcc\\):") |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1989 (a-re-dtc "^\\(To\\|Cc\\):") |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
1990 (a-re-db "^Bcc:") |
22799 | 1991 ;; to get a temporary changable copy |
1992 (mail-header-separator mail-header-separator) | |
1993 ) | |
22513 | 1994 (unwind-protect |
22799 | 1995 (save-excursion |
1996 (set-buffer feedmail-error-buffer) (erase-buffer) | |
1997 (set-buffer feedmail-prepped-text-buffer) (erase-buffer) | |
1998 | |
1999 ;; jam contents of user-supplied mail buffer into our scratch buffer | |
66668
857eb702a3f1
Use insert-buffer-substring, not insert-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
65797
diff
changeset
|
2000 (insert-buffer-substring feedmail-raw-text-buffer) |
22799 | 2001 |
2002 ;; require one newline at the end. | |
2003 (goto-char (point-max)) | |
2004 (or (= (preceding-char) ?\n) (insert ?\n)) | |
2005 | |
2006 (let ((case-fold-search nil)) | |
2007 ;; Change header-delimiter to be what mailers expect (empty line). | |
2008 ;; leaves match data in place or signals error | |
2009 (setq eoh-marker (feedmail-find-eoh)) | |
2010 (replace-match "\n") | |
2011 (setq mail-header-separator "")) | |
2012 | |
2013 ;; mail-aliases nil = mail-abbrevs.el | |
2014 (if (or feedmail-force-expand-mail-aliases | |
2015 (and (fboundp 'expand-mail-aliases) mail-aliases)) | |
2016 (expand-mail-aliases (point-min) eoh-marker)) | |
2017 | |
2018 ;; make it pretty | |
2019 (if feedmail-fill-to-cc (feedmail-fill-to-cc-function eoh-marker)) | |
2020 ;; ignore any blank lines in the header | |
2021 (goto-char (point-min)) | |
2022 (while (and (re-search-forward "\n\n\n*" eoh-marker t) (< (point) eoh-marker)) | |
2023 (replace-match "\n")) | |
22513 | 2024 |
22799 | 2025 (let ((case-fold-search t) (addr-regexp)) |
2026 (goto-char (point-min)) | |
2027 ;; there are some RFC-822 combinations/cases missed here, | |
2028 ;; but probably good enough and what users expect | |
2029 ;; | |
2030 ;; use resent-* stuff only if there is at least one non-empty one | |
2031 (setq feedmail-is-a-resend | |
2032 (re-search-forward | |
2033 ;; header name, followed by optional whitespace, followed by | |
2034 ;; non-whitespace, followed by anything, followed by newline; | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2035 ;; the idea is empty Resent-* headers are ignored |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2036 "^\\(Resent-To:\\|Resent-Cc:\\|Resent-Bcc:\\)\\s-*\\S-+.*$" |
22799 | 2037 eoh-marker t)) |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2038 ;; if we say so, gather the Bcc stuff before the main course |
22799 | 2039 (if (eq feedmail-deduce-bcc-where 'first) |
2040 (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rb) (setq addr-regexp a-re-db)) | |
2041 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list)))) | |
2042 ;; the main course | |
2043 (if (or (eq feedmail-deduce-bcc-where 'first) (eq feedmail-deduce-bcc-where 'last)) | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2044 ;; handled by first or last cases, so don't get Bcc stuff |
22799 | 2045 (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rtc) (setq addr-regexp a-re-dtc)) |
2046 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list))) | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2047 ;; not handled by first or last cases, so also get Bcc stuff |
22799 | 2048 (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rtcb) (setq addr-regexp a-re-dtcb)) |
2049 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list)))) | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2050 ;; if we say so, gather the Bcc stuff after the main course |
22799 | 2051 (if (eq feedmail-deduce-bcc-where 'last) |
2052 (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rb) (setq addr-regexp a-re-db)) | |
2053 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list)))) | |
2054 (if (not feedmail-address-list) (error "FQM: Sending...abandoned, no addressees")) | |
2055 ;; not needed, but meets user expectations | |
2056 (setq feedmail-address-list (nreverse feedmail-address-list)) | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2057 ;; Find and handle any Bcc fields. |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2058 (setq bcc-holder (feedmail-accume-n-nuke-header eoh-marker "^Bcc:")) |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2059 (setq resent-bcc-holder (feedmail-accume-n-nuke-header eoh-marker "^Resent-Bcc:")) |
22799 | 2060 (if (and bcc-holder (not feedmail-nuke-bcc)) |
2061 (progn (goto-char (point-min)) | |
2062 (insert bcc-holder))) | |
2063 (if (and resent-bcc-holder (not feedmail-nuke-resent-bcc)) | |
2064 (progn (goto-char (point-min)) | |
2065 (insert resent-bcc-holder))) | |
2066 (goto-char (point-min)) | |
22513 | 2067 |
22799 | 2068 ;; fiddle about, fiddle about, fiddle about.... |
2069 (feedmail-fiddle-from) | |
2070 (feedmail-fiddle-sender) | |
2071 (feedmail-fiddle-x-mailer) | |
2072 (feedmail-fiddle-message-id | |
2073 (or feedmail-queue-runner-is-active (buffer-file-name feedmail-raw-text-buffer))) | |
2074 (feedmail-fiddle-date | |
2075 (or feedmail-queue-runner-is-active (buffer-file-name feedmail-raw-text-buffer))) | |
2076 (feedmail-fiddle-list-of-fiddle-plexes feedmail-fiddle-plex-user-list) | |
2077 | |
2078 ;; don't send out a blank headers of various sorts | |
2079 ;; (this loses on continued line with a blank first line) | |
2080 (goto-char (point-min)) | |
2081 (and feedmail-nuke-empty-headers ; hey, who's an empty-header? | |
2082 (while (re-search-forward "^[A-Za-z0-9-]+:[ \t]*\n" eoh-marker t) | |
2083 (replace-match "")))) | |
2084 | |
2085 (run-hooks 'feedmail-last-chance-hook) | |
22513 | 2086 |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2087 (let ((fcc (feedmail-accume-n-nuke-header eoh-marker "^Fcc:")) |
22799 | 2088 (also-file) |
2089 (confirm (cond | |
2090 ((eq feedmail-confirm-outgoing 'immediate) | |
2091 (not feedmail-queue-runner-is-active)) | |
2092 ((eq feedmail-confirm-outgoing 'queued) feedmail-queue-runner-is-active) | |
2093 (t feedmail-confirm-outgoing)))) | |
2094 (if (or (not confirm) (feedmail-one-last-look feedmail-prepped-text-buffer)) | |
2095 (let ((user-mail-address (feedmail-envelope-deducer eoh-marker))) | |
2096 (feedmail-give-it-to-buffer-eater) | |
2097 (if (and (not feedmail-queue-runner-is-active) (setq also-file (buffer-file-name feedmail-raw-text-buffer))) | |
2098 (progn ; if a file but not running the queue, offer to delete it | |
2099 (setq also-file (expand-file-name also-file)) | |
2100 (if (or feedmail-queue-auto-file-nuke | |
2101 (y-or-n-p (format "FQM: Delete message file %s? " also-file))) | |
2102 (save-excursion | |
2103 ;; if we delete the affiliated file, get rid | |
2104 ;; of the file name association and make sure we | |
2105 ;; don't annoy people with a prompt on exit | |
2106 (delete-file also-file) | |
2107 (set-buffer feedmail-raw-text-buffer) | |
2108 (setq buffer-offer-save nil) | |
2109 (setq buffer-file-name nil) | |
2110 ) | |
2111 ))) | |
22513 | 2112 (goto-char (point-min)) |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2113 ;; re-insert and handle any Fcc fields (and, optionally, any Bcc). |
22799 | 2114 (if fcc (let ((default-buffer-file-type feedmail-force-binary-write)) |
2115 (insert fcc) | |
2116 (if (not feedmail-nuke-bcc-in-fcc) | |
2117 (progn (if bcc-holder (insert bcc-holder)) | |
2118 (if resent-bcc-holder (insert resent-bcc-holder)))) | |
22513 | 2119 |
22799 | 2120 (run-hooks 'feedmail-before-fcc-hook) |
22513 | 2121 |
22799 | 2122 (if feedmail-nuke-body-in-fcc |
2123 (progn (goto-char eoh-marker) | |
2124 (if (natnump feedmail-nuke-body-in-fcc) | |
2125 (forward-line feedmail-nuke-body-in-fcc)) | |
2126 (delete-region (point) (point-max)) | |
2127 )) | |
2128 (mail-do-fcc eoh-marker) | |
2129 ))) | |
2130 (error "FQM: Sending...abandoned") ; user bailed out of one-last-look | |
2131 ))) ; unwind-protect body (save-excursion) | |
22513 | 2132 |
22799 | 2133 ;; unwind-protect cleanup forms |
2134 (kill-buffer feedmail-prepped-text-buffer) | |
2135 (set-buffer feedmail-error-buffer) | |
2136 (if (zerop (buffer-size)) (kill-buffer feedmail-error-buffer) | |
2137 (progn (display-buffer feedmail-error-buffer) | |
2138 ;; read fast ... the meter is running | |
2139 (if (and feedmail-queue-runner-is-active feedmail-queue-chatty) | |
2140 (progn (message "FQM: Sending...failed") (ding t) (sit-for 3))) | |
2141 (error "FQM: Sending...failed"))) | |
2142 (set-buffer feedmail-raw-text-buffer)) | |
2143 ) ; let | |
22513 | 2144 (if (and feedmail-queue-chatty (not feedmail-queue-runner-is-active)) |
22799 | 2145 (progn |
2146 (feedmail-queue-reminder 'after-immediate) | |
2147 (sit-for feedmail-queue-chatty-sit-for))) | |
22513 | 2148 ) |
2149 | |
2150 | |
2151 (defun feedmail-fiddle-header (name value &optional action folding) | |
2152 "Internal feedmail function for jamming fields into message header. | |
2153 NAME, VALUE, ACTION, and FOLDING are the four elements of a | |
2154 fiddle-plex, as described in the documentation for the variable | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
2155 `feedmail-fiddle-plex-blurb'." |
22513 | 2156 (let ((case-fold-search t) |
22799 | 2157 (header-colon (concat (regexp-quote name) ":")) |
2158 header-regexp eoh-marker has-like ag-like val-like that-point) | |
2159 (setq header-regexp (concat "^" header-colon)) | |
2160 (setq eoh-marker (feedmail-find-eoh)) | |
2161 (goto-char (point-min)) | |
2162 (setq has-like (re-search-forward header-regexp eoh-marker t)) | |
22513 | 2163 |
22799 | 2164 (if (not action) (setq action 'supplement)) |
2165 (cond | |
2166 ((eq action 'supplement) | |
2167 ;; trim leading/trailing whitespace | |
2168 (if (string-match "\\`[ \t\n]+" value) | |
2169 (setq value (substring value (match-end 0)))) | |
2170 (if (string-match "[ \t\n]+\\'" value) | |
2171 (setq value (substring value 0 (match-beginning 0)))) | |
2172 (if (> (length value) 0) | |
2173 (progn | |
2174 (if feedmail-fiddle-headers-upwardly | |
2175 (goto-char (point-min)) | |
2176 (goto-char eoh-marker)) | |
2177 (setq that-point (point)) | |
2178 (insert name ": " value "\n") | |
2179 (if folding (feedmail-fill-this-one that-point (point)))))) | |
22513 | 2180 |
22799 | 2181 ((eq action 'replace) |
2182 (if has-like (feedmail-accume-n-nuke-header eoh-marker header-regexp)) | |
2183 (feedmail-fiddle-header name value 'supplement folding)) | |
22513 | 2184 |
22799 | 2185 ((eq action 'create) |
2186 (if (not has-like) (feedmail-fiddle-header name value 'supplement folding))) | |
22513 | 2187 |
22799 | 2188 ((eq action 'combine) |
2189 (setq val-like (nth 1 value)) | |
2190 (setq ag-like (or (feedmail-accume-n-nuke-header eoh-marker header-regexp) "")) | |
2191 ;; get rid of initial header name from first instance (front of string) | |
2192 (if (string-match (concat header-regexp "[ \t\n]+") ag-like) | |
2193 (setq ag-like (replace-match "" t t ag-like))) | |
2194 ;; get rid of embedded header names from subsequent instances | |
2195 (while (string-match (concat "\n" header-colon "[ \t\n]+") ag-like) | |
2196 (setq ag-like (replace-match "\n\t" t t ag-like))) | |
2197 ;; trim leading/trailing whitespace | |
2198 (if (string-match "\\`[ \t\n]+" ag-like) | |
2199 (setq ag-like (substring ag-like (match-end 0)))) | |
2200 (if (string-match "[ \t\n]+\\'" ag-like) | |
2201 (setq ag-like (substring ag-like 0 (match-beginning 0)))) | |
2202 ;; if ag-like is not nil and not an empty string, transform it via a function | |
2203 ;; call or format operation | |
2204 (if (> (length ag-like) 0) | |
2205 (setq ag-like | |
2206 (cond | |
2207 ((and (symbolp val-like) (fboundp val-like)) | |
2208 (funcall val-like name ag-like)) | |
2209 ((stringp val-like) | |
2210 (format val-like ag-like)) | |
2211 (t nil)))) | |
2212 (feedmail-fiddle-header name (concat (nth 0 value) ag-like (nth 2 value)) 'supplement folding))) | |
2213 )) | |
22513 | 2214 |
2215 (defun feedmail-give-it-to-buffer-eater () | |
2216 (save-excursion | |
22799 | 2217 (if feedmail-enable-spray |
2218 (mapcar | |
2219 '(lambda (feedmail-spray-this-address) | |
2220 (let ((spray-buffer (get-buffer-create " *FQM Outgoing Email Spray*"))) | |
2221 (save-excursion | |
2222 (set-buffer spray-buffer) | |
2223 (erase-buffer) | |
2224 ;; not life's most efficient methodology, but spraying isn't | |
2225 ;; an every-5-minutes event either | |
66668
857eb702a3f1
Use insert-buffer-substring, not insert-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
65797
diff
changeset
|
2226 (insert-buffer-substring feedmail-prepped-text-buffer) |
22799 | 2227 ;; There's a good case to me made that each separate transmission of |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2228 ;; a message in the spray should have a distinct Message-Id:. There |
22799 | 2229 ;; is also a less compelling argument in the other direction. I think |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2230 ;; they technically should have distinct Message-Id:s, but I doubt that |
22799 | 2231 ;; anyone cares, practically. If someone complains about it, I'll add |
2232 ;; it. | |
2233 (feedmail-fiddle-list-of-spray-fiddle-plexes feedmail-spray-address-fiddle-plex-list) | |
2234 ;; this (let ) is just in case some buffer eater | |
2235 ;; is cheating and using the global variable name instead | |
2236 ;; of its argument to find the buffer | |
2237 (let ((feedmail-prepped-text-buffer spray-buffer)) | |
2238 (funcall feedmail-buffer-eating-function | |
22513 | 2239 feedmail-prepped-text-buffer |
2240 feedmail-error-buffer | |
22799 | 2241 (list feedmail-spray-this-address)))) |
2242 (kill-buffer spray-buffer) | |
2243 )) | |
2244 feedmail-address-list) | |
2245 (funcall feedmail-buffer-eating-function | |
2246 feedmail-prepped-text-buffer | |
2247 feedmail-error-buffer | |
2248 feedmail-address-list)))) | |
22513 | 2249 |
2250 | |
2251 (defun feedmail-envelope-deducer (eoh-marker) | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
2252 "If `feedmail-deduce-envelope-from' is false, simply return `user-mail-address'. |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2253 Else, look for Sender: or From: (or Resent-*) and |
22513 | 2254 return that value." |
2255 (if (not feedmail-deduce-envelope-from) | |
22799 | 2256 user-mail-address |
2257 (let ((from-list)) | |
2258 (setq from-list | |
2259 (feedmail-deduce-address-list | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2260 (current-buffer) (point-min) eoh-marker (if feedmail-is-a-resend "^Resent-Sender:" "^Sender:") |
22799 | 2261 from-list)) |
2262 (if (not from-list) | |
22513 | 2263 (setq from-list |
22799 | 2264 (feedmail-deduce-address-list |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2265 (current-buffer) (point-min) eoh-marker (if feedmail-is-a-resend "^Resent-From:" "^From:") |
22799 | 2266 from-list))) |
2267 (if (and from-list (car from-list)) (car from-list) user-mail-address)))) | |
22513 | 2268 |
2269 | |
2270 (defun feedmail-fiddle-from () | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2271 "Fiddle From:." |
22513 | 2272 ;; default is to fall off the end of the list and do nothing |
2273 (cond | |
2274 ;; nil means do nothing | |
2275 ((eq nil feedmail-from-line) nil) | |
2276 ;; t is the same a using the default computation, so compute it and recurse | |
2277 ;; user-full-name suggested by kpc@ptolemy.arc.nasa.gov (=Kimball Collins) | |
2278 ;; improvement using user-mail-address suggested by | |
2279 ;; gray@austin.apc.slb.com (Douglas Gray Stephens) | |
2280 ((eq t feedmail-from-line) | |
22799 | 2281 (let ((feedmail-from-line |
2282 (let ((at-stuff | |
2283 (if user-mail-address user-mail-address (concat (user-login-name) "@" (system-name))))) | |
2284 (cond | |
2285 ((eq mail-from-style nil) at-stuff) | |
2286 ((eq mail-from-style 'parens) (concat at-stuff " (" (user-full-name) ")")) | |
2287 ((eq mail-from-style 'angles) (concat "\"" (user-full-name) "\" <" at-stuff ">")) | |
2288 )))) | |
2289 (feedmail-fiddle-from))) | |
22513 | 2290 |
2291 ;; if it's a string, simply make a fiddle-plex out of it and recurse | |
2292 ((stringp feedmail-from-line) | |
22799 | 2293 (let ((feedmail-from-line (list "ignored" feedmail-from-line 'create))) |
2294 (feedmail-fiddle-from))) | |
22513 | 2295 |
2296 ;; if it's a function, call it and recurse with the resulting value | |
2297 ((and (symbolp feedmail-from-line) (fboundp feedmail-from-line)) | |
22799 | 2298 (let ((feedmail-from-line (funcall feedmail-from-line))) |
2299 (feedmail-fiddle-from))) | |
22513 | 2300 |
2301 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle | |
2302 ((listp feedmail-from-line) | |
22799 | 2303 (feedmail-fiddle-header |
2304 (if feedmail-is-a-resend "Resent-From" "From") | |
2305 (nth 1 feedmail-from-line) ; value | |
2306 (nth 2 feedmail-from-line) ; action | |
2307 (nth 3 feedmail-from-line))))) ; folding | |
22513 | 2308 |
2309 | |
2310 (defun feedmail-fiddle-sender () | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2311 "Fiddle Sender:." |
22513 | 2312 ;; default is to fall off the end of the list and do nothing |
2313 (cond | |
2314 ;; nil means do nothing | |
2315 ((eq nil feedmail-sender-line) nil) | |
2316 ;; t is not allowed, but handled it just to avoid bugs later | |
2317 ((eq t feedmail-sender-line) nil) | |
2318 | |
2319 ;; if it's a string, simply make a fiddle-plex out of it and recurse | |
2320 ((stringp feedmail-sender-line) | |
22799 | 2321 (let ((feedmail-sender-line (list "ignored" feedmail-sender-line 'create))) |
2322 (feedmail-fiddle-sender))) | |
22513 | 2323 |
2324 ;; if it's a function, call it and recurse with the resulting value | |
2325 ((and (symbolp feedmail-sender-line) (fboundp feedmail-sender-line)) | |
22799 | 2326 (let ((feedmail-sender-line (funcall feedmail-sender-line))) |
2327 (feedmail-fiddle-sender))) | |
22513 | 2328 |
2329 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle | |
2330 ((listp feedmail-sender-line) | |
22799 | 2331 (feedmail-fiddle-header |
2332 (if feedmail-is-a-resend "Resent-Sender" "Sender") | |
2333 (nth 1 feedmail-sender-line) ; value | |
2334 (nth 2 feedmail-sender-line) ; action | |
2335 (nth 3 feedmail-sender-line))))) ; folding | |
22513 | 2336 |
2337 | |
2338 (defun feedmail-default-date-generator (maybe-file) | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2339 "Default function for generating Date: header contents." |
22513 | 2340 (let ((date-time)) |
22799 | 2341 (if (and (not feedmail-queue-use-send-time-for-date) maybe-file) |
2342 (setq date-time (nth 5 (file-attributes maybe-file)))) | |
2343 (feedmail-rfc822-date date-time)) | |
22513 | 2344 ) |
2345 | |
2346 | |
2347 (defun feedmail-fiddle-date (maybe-file) | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
2348 "Fiddle Date:. See documentation of `feedmail-date-generator'." |
22513 | 2349 ;; default is to fall off the end of the list and do nothing |
2350 (cond | |
2351 ;; nil means do nothing | |
2352 ((eq nil feedmail-date-generator) nil) | |
2353 ;; t is the same a using the function feedmail-default-date-generator, so let it and recurse | |
2354 ((eq t feedmail-date-generator) | |
22799 | 2355 (let ((feedmail-date-generator (feedmail-default-date-generator maybe-file))) |
2356 (feedmail-fiddle-date maybe-file))) | |
22513 | 2357 |
2358 ;; if it's a string, simply make a fiddle-plex out of it and recurse | |
2359 ((stringp feedmail-date-generator) | |
22799 | 2360 (let ((feedmail-date-generator (list "ignored" feedmail-date-generator 'create))) |
2361 (feedmail-fiddle-date maybe-file))) | |
22513 | 2362 |
2363 ;; if it's a function, call it and recurse with the resulting value | |
2364 ((and (symbolp feedmail-date-generator) (fboundp feedmail-date-generator)) | |
22799 | 2365 (let ((feedmail-date-generator (funcall feedmail-date-generator maybe-file))) |
2366 (feedmail-fiddle-date maybe-file))) | |
22513 | 2367 |
2368 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle | |
2369 ((listp feedmail-date-generator) | |
22799 | 2370 (feedmail-fiddle-header |
2371 (if feedmail-is-a-resend "Resent-Date" "Date") | |
2372 (nth 1 feedmail-date-generator) ; value | |
2373 (nth 2 feedmail-date-generator) ; action | |
2374 (nth 3 feedmail-date-generator))))) ; folding | |
22513 | 2375 |
2376 | |
2377 (defun feedmail-default-message-id-generator (maybe-file) | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2378 "Default function for generating Message-Id: header contents. |
22513 | 2379 Based on a date and a sort of random number for tie breaking. Unless |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
2380 `feedmail-message-id-suffix' is defined, uses `user-mail-address', so be |
22513 | 2381 sure it's set." |
2382 (let ((date-time) | |
22799 | 2383 (end-stuff (if feedmail-message-id-suffix feedmail-message-id-suffix user-mail-address))) |
2384 (if (string-match "^\\(.*\\)@" end-stuff) | |
2385 (setq end-stuff | |
2386 (concat (if (equal (match-beginning 1) (match-end 1)) "" "-") end-stuff)) | |
2387 (setq end-stuff (concat "@" end-stuff))) | |
2388 (if (and (not feedmail-queue-use-send-time-for-message-id) maybe-file) | |
2389 (setq date-time (nth 5 (file-attributes maybe-file)))) | |
2390 (format "<%d-%s%s%s>" | |
2391 (mod (random) 10000) | |
2392 (format-time-string "%a%d%b%Y%H%M%S" date-time) | |
2393 (feedmail-rfc822-time-zone date-time) | |
2394 end-stuff)) | |
22513 | 2395 ) |
2396 | |
2397 (defun feedmail-fiddle-message-id (maybe-file) | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
2398 "Fiddle Message-Id:. See documentation of `feedmail-message-id-generator'." |
22513 | 2399 ;; default is to fall off the end of the list and do nothing |
2400 (cond | |
2401 ;; nil means do nothing | |
2402 ((eq nil feedmail-message-id-generator) nil) | |
2403 ;; t is the same a using the function feedmail-default-message-id-generator, so let it and recurse | |
2404 ((eq t feedmail-message-id-generator) | |
22799 | 2405 (let ((feedmail-message-id-generator (feedmail-default-message-id-generator maybe-file))) |
2406 (feedmail-fiddle-message-id maybe-file))) | |
22513 | 2407 |
2408 ;; if it's a string, simply make a fiddle-plex out of it and recurse | |
2409 ((stringp feedmail-message-id-generator) | |
22799 | 2410 (let ((feedmail-message-id-generator (list "ignored" feedmail-message-id-generator 'create))) |
2411 (feedmail-fiddle-message-id maybe-file))) | |
22513 | 2412 |
2413 ;; if it's a function, call it and recurse with the resulting value | |
2414 ((and (symbolp feedmail-message-id-generator) (fboundp feedmail-message-id-generator)) | |
22799 | 2415 (let ((feedmail-message-id-generator (funcall feedmail-message-id-generator maybe-file))) |
2416 (feedmail-fiddle-message-id maybe-file))) | |
22513 | 2417 |
2418 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle | |
2419 ((listp feedmail-message-id-generator) | |
22799 | 2420 (feedmail-fiddle-header |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2421 (if feedmail-is-a-resend "Resent-Message-Id" "Message-Id") |
22799 | 2422 (nth 1 feedmail-message-id-generator) ; value |
2423 (nth 2 feedmail-message-id-generator) ; action | |
2424 (nth 3 feedmail-message-id-generator))))) ; folding | |
22513 | 2425 |
2426 | |
2427 (defun feedmail-default-x-mailer-generator () | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2428 "Default function for generating X-Mailer: header contents." |
22513 | 2429 (concat |
2430 (let ((case-fold-search t)) (if (string-match "emacs" emacs-version) "" "emacs ")) | |
2431 emacs-version " (via feedmail " feedmail-patch-level | |
2432 (if feedmail-queue-runner-is-active " Q" " I") | |
2433 (if feedmail-enable-spray "S" "") | |
2434 (if feedmail-x-mailer-line-user-appendage ") " ")") | |
2435 feedmail-x-mailer-line-user-appendage)) | |
2436 | |
2437 | |
2438 (defun feedmail-fiddle-x-mailer () | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
2439 "Fiddle X-Mailer:. See documentation of `feedmail-x-mailer-line'." |
22513 | 2440 ;; default is to fall off the end of the list and do nothing |
2441 (cond | |
2442 ;; t is the same a using the function feedmail-default-x-mailer-generator, so let it and recurse | |
2443 ((eq t feedmail-x-mailer-line) | |
22799 | 2444 (let ((feedmail-x-mailer-line (feedmail-default-x-mailer-generator))) |
2445 (feedmail-fiddle-x-mailer))) | |
22513 | 2446 |
2447 ;; if it's a string, simply make a fiddle-plex out of it and recurse | |
2448 ((stringp feedmail-x-mailer-line) | |
22799 | 2449 (let ((feedmail-x-mailer-line (list "ignored" (list feedmail-x-mailer-line ";\n\t%s") 'combine))) |
2450 (feedmail-fiddle-x-mailer))) | |
22513 | 2451 |
2452 ;; if it's a function, call it and recurse with the resulting value | |
2453 ((and (symbolp feedmail-x-mailer-line) (fboundp feedmail-x-mailer-line)) | |
22799 | 2454 (let ((feedmail-x-mailer-line (funcall feedmail-x-mailer-line))) |
2455 (feedmail-fiddle-x-mailer))) | |
22513 | 2456 |
2457 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle | |
2458 ((listp feedmail-x-mailer-line) | |
22799 | 2459 (feedmail-fiddle-header |
2460 (if feedmail-is-a-resend "X-Resent-Mailer" "X-Mailer") | |
2461 (nth 1 feedmail-x-mailer-line) ; value | |
2462 (nth 2 feedmail-x-mailer-line) ; action | |
2463 (nth 3 feedmail-x-mailer-line))))) ; folding | |
22513 | 2464 |
2465 | |
2466 (defun feedmail-fiddle-spray-address (addy-plex) | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
2467 "Fiddle header for single spray address. Uses `feedmail-spray-this-address'." |
22513 | 2468 ;; default is to fall off the end of the list and do nothing |
2469 (cond | |
2470 ;; nil means do nothing | |
2471 ((eq nil addy-plex) nil) | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2472 ;; t means the same as using "To:" and unembellished addy |
22513 | 2473 ((eq t addy-plex) |
22799 | 2474 (let ((addy-plex (list "To" feedmail-spray-this-address))) |
2475 (feedmail-fiddle-spray-address addy-plex))) | |
22513 | 2476 |
2477 ;; if it's a string, simply make a fiddle-plex out of it and recurse, assuming | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2478 ;; the string names a header field (e.g., "To") |
22513 | 2479 ((stringp addy-plex) |
22799 | 2480 (let ((addy-plex (list addy-plex feedmail-spray-this-address))) |
2481 (feedmail-fiddle-spray-address addy-plex))) | |
22513 | 2482 |
2483 ;; if it's a function, call it and recurse with the resulting value | |
2484 ((and (symbolp addy-plex) (fboundp addy-plex)) | |
22799 | 2485 (let ((addy-plex (funcall addy-plex))) |
2486 (feedmail-fiddle-spray-address addy-plex))) | |
22513 | 2487 |
2488 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle | |
2489 ((listp addy-plex) | |
22799 | 2490 (feedmail-fiddle-header |
2491 (nth 0 addy-plex) ; name | |
2492 (nth 1 addy-plex) ; value | |
2493 (nth 2 addy-plex) ; action | |
2494 (nth 3 addy-plex))))) ; folding | |
22513 | 2495 |
2496 | |
2497 (defun feedmail-fiddle-list-of-spray-fiddle-plexes (list-of-fiddle-plexes) | |
2498 "Fiddling based on a list of fiddle-plexes for spraying." | |
2499 ;; default is to fall off the end of the list and do nothing | |
2500 (let ((lofp list-of-fiddle-plexes) fp) | |
22609 | 2501 (if (listp lofp) |
2502 (while lofp | |
2503 (setq fp (car lofp)) | |
2504 (setq lofp (cdr lofp)) | |
2505 (feedmail-fiddle-spray-address fp)) | |
2506 (feedmail-fiddle-spray-address lofp)))) | |
22513 | 2507 |
2508 | |
2509 (defun feedmail-fiddle-list-of-fiddle-plexes (list-of-fiddle-plexes) | |
2510 "Fiddling based on a list of fiddle-plexes. Values t, nil, and string are pointless." | |
2511 ;; default is to fall off the end of the list and do nothing | |
2512 (let ((lofp list-of-fiddle-plexes) fp) | |
22609 | 2513 (while lofp |
2514 (setq fp (car lofp)) | |
2515 (setq lofp (cdr lofp)) | |
2516 (cond | |
22513 | 2517 |
22609 | 2518 ;; if it's a function, call it and recurse with the resulting value |
2519 ((and (symbolp fp) (fboundp fp)) | |
2520 (let ((lofp (list (funcall fp)))) (feedmail-fiddle-list-of-fiddle-plexes lofp))) | |
22513 | 2521 |
22609 | 2522 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle |
2523 ((listp fp) | |
2524 (feedmail-fiddle-header | |
2525 (nth 0 fp) | |
22799 | 2526 (nth 1 fp) ; value |
2527 (nth 2 fp) ; action | |
2528 (nth 3 fp))))))) ; folding | |
22513 | 2529 |
2530 | |
2531 (defun feedmail-accume-n-nuke-header (header-end header-regexp) | |
2532 "Delete headers matching a regexp and their continuation lines. | |
2533 There may be multiple such lines, and each may have arbitrarily | |
2534 many continuation lines. Return an accumulation of the deleted | |
2535 headers, including the intervening newlines." | |
2536 (let ((case-fold-search t) (dropout)) | |
22609 | 2537 (save-excursion |
2538 (goto-char (point-min)) | |
2539 ;; iterate over all matching lines | |
2540 (while (re-search-forward header-regexp header-end t) | |
2541 (forward-line 1) | |
2542 (setq dropout (concat dropout (buffer-substring (match-beginning 0) (point)))) | |
2543 (delete-region (match-beginning 0) (point)) | |
2544 ;; get rid of any continuation lines | |
2545 (while (and (looking-at "^[ \t].*\n") (< (point) header-end)) | |
2546 (forward-line 1) | |
2547 (setq dropout (concat dropout (buffer-substring (match-beginning 0) (point)))) | |
2548 (replace-match "")))) | |
22799 | 2549 (identity dropout))) |
22513 | 2550 |
2551 (defun feedmail-fill-to-cc-function (header-end) | |
2552 "Smart filling of address headers (don't be fooled by the name). | |
2553 The filling tries to avoid splitting lines except at commas. This | |
2554 avoids, in particular, splitting within parenthesized comments in | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2555 addresses. Headers filled include From:, Reply-To:, To:, Cc:, Bcc:, |
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2556 Resent-To:, Resent-Cc:, and Resent-Bcc:." |
22513 | 2557 (let ((case-fold-search t) |
22799 | 2558 this-line |
2559 this-line-end) | |
2560 (save-excursion | |
2561 (goto-char (point-min)) | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2562 ;; iterate over all To:/Cc:, etc, lines |
22799 | 2563 (while |
2564 (re-search-forward | |
22801
e71025b5e000
Avoid using all-caps for non-arguments.
Karl Heuer <kwzh@gnu.org>
parents:
22800
diff
changeset
|
2565 "^\\(From:\\|Reply-To:\\|To:\\|Cc:\\|Bcc:\\|Resent-To:\\|Resent-Cc:\\|Resent-Bcc:\\)" |
22799 | 2566 header-end t) |
2567 (setq this-line (match-beginning 0)) | |
2568 ;; replace 0 or more leading spaces with a single space | |
2569 (and (looking-at "[ \t]*") (replace-match " ")) | |
2570 (forward-line 1) | |
2571 ;; get any continuation lines | |
2572 (while (and (looking-at "[ \t]+") (< (point) header-end)) | |
2573 (forward-line 1)) | |
2574 (setq this-line-end (point-marker)) | |
2575 (save-excursion (feedmail-fill-this-one this-line this-line-end)) | |
2576 )))) | |
22513 | 2577 |
2578 | |
2579 (defun feedmail-fill-this-one (this-line this-line-end) | |
2580 "In-place smart filling of the region bounded by the two arguments." | |
2581 (let ((fill-prefix "\t") | |
22799 | 2582 (fill-column feedmail-fill-to-cc-fill-column)) |
2583 ;; The general idea is to break only on commas. Collapse | |
2584 ;; multiple whitespace to a single blank; change | |
2585 ;; all the blanks to something unprintable; change the | |
2586 ;; commas to blanks; fill the region; change it back. | |
2587 (goto-char this-line) | |
2588 (while (re-search-forward "\\s-+" (1- this-line-end) t) | |
2589 (replace-match " ")) | |
2590 | |
2591 (subst-char-in-region this-line this-line-end ? 2 t) ; blank->C-b | |
2592 (subst-char-in-region this-line this-line-end ?, ? t) ; comma->blank | |
2593 | |
2594 (fill-region-as-paragraph this-line this-line-end) | |
2595 | |
2596 (subst-char-in-region this-line this-line-end ? ?, t) ; comma<-blank | |
2597 (subst-char-in-region this-line this-line-end 2 ? t) ; blank<-C-b | |
2598 | |
2599 ;; look out for missing commas before continuation lines | |
2600 (goto-char this-line) | |
2601 (while (re-search-forward "\\([^,]\\)\n\t[ ]*" this-line-end t) | |
2602 (replace-match "\\1,\n\t")) | |
2603 )) | |
22513 | 2604 |
2605 | |
22799 | 2606 (require 'mail-utils) ; pick up mail-strip-quoted-names |
22513 | 2607 (defun feedmail-deduce-address-list (message-buffer header-start header-end addr-regexp address-list) |
2608 "Get address list with all comments and other excitement trimmed. | |
2609 Addresses are collected only from headers whose names match the fourth | |
73728
d8a07f1f5442
(feedmail-queue-reminder, feedmail-queue-reminder-alist,
Juanma Barranquero <lekktu@gmail.com>
parents:
72635
diff
changeset
|
2610 argument. Returns a list of strings. Duplicate addresses will have |
22513 | 2611 been weeded out." |
2612 (let ((simple-address) | |
22799 | 2613 (address-blob) |
2614 (this-line) | |
2615 (this-line-end)) | |
2616 (unwind-protect | |
2617 (save-excursion | |
2618 (set-buffer (get-buffer-create " *FQM scratch*")) (erase-buffer) | |
2619 (insert-buffer-substring message-buffer header-start header-end) | |
2620 (goto-char (point-min)) | |
2621 (let ((case-fold-search t)) | |
2622 (while (re-search-forward addr-regexp (point-max) t) | |
2623 (replace-match "") | |
2624 (setq this-line (match-beginning 0)) | |
2625 (forward-line 1) | |
2626 ;; get any continuation lines | |
2627 (while (and (looking-at "^[ \t]+") (< (point) (point-max))) | |
2628 (forward-line 1)) | |
2629 (setq this-line-end (point-marker)) | |
2630 ;; only keep if we don't have it already | |
2631 (setq address-blob | |
2632 (mail-strip-quoted-names (buffer-substring this-line this-line-end))) | |
2633 (while (string-match "\\([, \t\n\r]*\\)\\([^, \t\n\r]+\\)" address-blob) | |
2634 (setq simple-address (substring address-blob (match-beginning 2) (match-end 2))) | |
2635 (setq address-blob (replace-match "" t t address-blob)) | |
2636 (if (not (member simple-address address-list)) | |
2637 (add-to-list 'address-list simple-address))) | |
2638 )) | |
2639 (kill-buffer nil))) | |
2640 (identity address-list))) | |
22513 | 2641 |
2642 | |
2643 (defun feedmail-one-last-look (feedmail-prepped-text-buffer) | |
2644 "Offer the user one last chance to give it up." | |
2645 (save-excursion | |
22799 | 2646 (save-window-excursion |
2647 (switch-to-buffer feedmail-prepped-text-buffer) | |
2648 (if (and (fboundp 'y-or-n-p-with-timeout) (numberp feedmail-confirm-outgoing-timeout)) | |
2649 (y-or-n-p-with-timeout | |
2650 "FQM: Send this email? " | |
2651 (abs feedmail-confirm-outgoing-timeout) | |
2652 (> feedmail-confirm-outgoing-timeout 0)) | |
2653 (y-or-n-p "FQM: Send this email? ")) | |
2654 ))) | |
22513 | 2655 |
2656 (defun feedmail-fqm-p (might-be) | |
2657 "Internal; does filename end with FQM suffix?" | |
2658 (string-match (concat (regexp-quote feedmail-queue-fqm-suffix) "$") might-be)) | |
2659 | |
2660 | |
2661 (defun feedmail-find-eoh (&optional noerror) | |
2662 "Internal; finds the end of message header fields, returns mark just before it" | |
2663 (save-excursion | |
22799 | 2664 (goto-char (point-min)) |
26778 | 2665 (when (or (re-search-forward (concat "^" |
2666 (regexp-quote mail-header-separator) | |
2667 "\n") | |
2668 nil noerror) | |
2669 (and feedmail-queue-alternative-mail-header-separator | |
2670 (re-search-forward | |
2671 (concat "^" | |
2672 (regexp-quote | |
2673 feedmail-queue-alternative-mail-header-separator) | |
2674 "\n") | |
2675 nil noerror))) | |
2676 (forward-line -1) | |
2677 (point-marker)))) | |
22513 | 2678 |
2679 (provide 'feedmail) | |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
35616
diff
changeset
|
2680 |
52401 | 2681 ;;; arch-tag: ec27b380-11c0-4dfd-8436-f636cf2bb992 |
22513 | 2682 ;;; feedmail.el ends here |