annotate lisp/mail/uce.el @ 110859:7aa4fdb60d57

shr.el (shr-insert): Don't insert double spaces. auth.texi (Help for users, GnuPG and EasyPG Assistant Configuration): Update docs. gnus-registry.el, nnregistry.el: Remove nnregistry refer method auto-install and update docs. gnus.texi (Finding the Parent, The Gnus Registry, Registry Article Refer Method): Update docs for nnregistry.el. gnus-demon.el, gnus-group.el, gnus-msg.el, gnus-sum.el, gnus-util.el, gnus.el: Rename `gnus-pull' to `gnus-alist-pull'. gnus.texi (Article Washing): Add mm-shr. mm-decode.el (mm-text-html-renderer): Add mm-shr in choice list.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Fri, 08 Oct 2010 23:55:33 +0000
parents 1d1d5d9bd884
children 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; uce.el --- facilitate reply to unsolicited commercial email
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
3 ;; Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105322
diff changeset
4 ;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
6 ;; Author: stanislav shalunov <shalunov@mccme.ru>
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Created: 10 Dec 1996
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
8 ;; Keywords: mail, uce, unsolicited commercial email
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
38401
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 31224
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; (at your option) any later version.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
38401
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 31224
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 31224
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 31224
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 31224
diff changeset
20 ;; GNU General Public License for more details.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
27 ;; The code in this file provides a semi-automatic means of replying
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
28 ;; to unsolicited commercial email (UCE) you might get. Currently, it
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
29 ;; only works with Rmail and Gnus. If you would like to make it work
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
30 ;; with other mail readers, see the mail-client dependent section of
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
31 ;; uce-reply-to-uce. Please let me know about your changes so I can
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
32 ;; incorporate them. I'd appreciate it.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
34 ;; The command uce-reply-to-uce, if called when the current message
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
35 ;; buffer is a UCE, will setup a reply *mail* buffer as follows. It
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
36 ;; scans the full headers of the message for: 1) the normal return
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
37 ;; address of the sender (From, Reply-To lines), and puts these
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
38 ;; addresses into the To: header, along with abuse@offenders.host; 2)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
39 ;; the mailhub that first saw this message, and adds the address of
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
40 ;; its postmaster into the To: header; and 3), finally, it looks at
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
41 ;; the Message-Id and adds the postmaster of that host to the list of
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
42 ;; addresses.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
44 ;; Then, we add an "Errors-To: nobody@localhost" header, so that if
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
45 ;; some of these addresses are not actually correct, we will never see
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;; bounced mail. Also, mail-self-blind and mail-archive-file-name
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;; take no effect: the ideology is that we don't want to save junk or
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; replies to junk.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
50 ;; Then we insert a template into the buffer (a customizable message
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
51 ;; that explains what has happened), customizable signature, and the
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; original message with full headers and envelope for postmasters.
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
53 ;; Then the buffer is left for editing.
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
54
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
55 ;; The reason that the function uce-reply-to-uce is mail-client
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
56 ;; dependent is that we want the full headers of the original message,
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
57 ;; nothing stripped. If we use the normal means of inserting the
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
58 ;; original message into the *mail* buffer, headers like Received:
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
59 ;; (not really headers, but envelope lines) will be stripped, while
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
60 ;; they bear valuable information for us and postmasters. I do wish
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
61 ;; that there would be some portable way to write this function, but I
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
62 ;; am not aware of any.
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
63
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
64 ;; Usage:
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
66 ;; Place uce.el in your load-path (and optionally byte-compile it).
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
67 ;; Add the following line to your ~/.emacs:
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
68 ;; (autoload 'uce-reply-to-uce "uce" "Reply to UCEs" t nil)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
69 ;; If you want to use it with Gnus rather than Rmail:
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
70 ;; (setq uce-mail-reader 'gnus)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
71
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
72 ;; Options:
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
73
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
74 ;; uce-message-text is a template that will be inserted into buffer.
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
75 ;; It has a reasonable default. If you want to write some scarier
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
76 ;; one, please do so and send it to me. Please keep it polite.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
78 ;; uce-signature behaves just like mail-signature. If nil, nothing is
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
79 ;; inserted, if t, file ~/.signature is used, if a string, its
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
80 ;; contents are inserted into buffer.
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
81
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
82 ;; uce-uce-separator is a line that separates your message from the
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
83 ;; UCE that you enclose.
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
84
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
85 ;; uce-subject-line will be used as the subject of the outgoing message.
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
86
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
87
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
88 ;;; Change Log:
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 ;; Dec 10, 1996 -- posted draft version to gnu.sources.emacs
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 ;; Dec 11, 1996 -- fixed some typos, and Francesco Potorti`
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 ;; <F.Potorti@cnuce.cnr.it> pointed out that my use of defvar was
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 ;; weird, suggested fix, and added let form.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 ;; Dec 17, 1996 -- made scanning for host names little bit more clever
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 ;; (obviously bogus stuff like localhost is now ignored).
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
99 ;; Nov 11, 1997 -- incorporated changes from Mikael Djurfeldt
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
100 ;; <mdj@nada.kth.se> to make uce.el work with Gnus. Changed the text
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
101 ;; of message that is sent.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
102
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
103 ;; Dec 3, 1997 -- changes from Gareth Jones <gdj1@gdjones.demon.co.uk>
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
104 ;; handling Received headers following some line like `From:'.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
105
31224
fa7a79afcbf7 (uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents: 23458
diff changeset
106 ;; Aug 16, 2000 -- changes from Detlev Zundel
fa7a79afcbf7 (uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents: 23458
diff changeset
107 ;; <detlev.zundel@stud.uni-karlsruhe.de> to make uce.el work with the
fa7a79afcbf7 (uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents: 23458
diff changeset
108 ;; latest Gnus. Lars told him it should work for all versions of Gnus
fa7a79afcbf7 (uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents: 23458
diff changeset
109 ;; younger than three years.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 ;;; Code:
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113
65205
98f74806263a (gnus-original-article-buffer, mail-reply-buffer, rmail-current-message):
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
114 (defvar gnus-original-article-buffer)
98f74806263a (gnus-original-article-buffer, mail-reply-buffer, rmail-current-message):
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
115 (defvar mail-reply-buffer)
98f74806263a (gnus-original-article-buffer, mail-reply-buffer, rmail-current-message):
Juanma Barranquero <lekktu@gmail.com>
parents: 64754
diff changeset
116
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (require 'sendmail)
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
118 ;; Those sections of code which are dependent upon
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
119 ;; RMAIL are only evaluated if we have received a message with RMAIL...
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
120 ;;(require 'rmail)
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
121
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
122 (defgroup uce nil
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
123 "Facilitate reply to unsolicited commercial email."
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
124 :prefix "uce-"
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
125 :group 'mail)
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
126
22462
198054d3498c Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents: 22416
diff changeset
127 (defcustom uce-mail-reader 'rmail
198054d3498c Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents: 22416
diff changeset
128 "A symbol indicating which mail reader you are using.
198054d3498c Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents: 22416
diff changeset
129 Choose from: `gnus', `rmail'."
198054d3498c Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents: 22416
diff changeset
130 :type '(choice (const gnus) (const rmail))
198054d3498c Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents: 22416
diff changeset
131 :version "20.3"
198054d3498c Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents: 22416
diff changeset
132 :group 'uce)
198054d3498c Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents: 22416
diff changeset
133
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
134 (defcustom uce-setup-hook nil
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 "Hook to run after UCE rant message is composed.
22462
198054d3498c Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents: 22416
diff changeset
136 This hook is run after `mail-setup-hook', which is run as well."
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
137 :type 'hook
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
138 :group 'uce)
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
140 (defcustom uce-message-text
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 "Recently, I have received an Unsolicited Commercial E-mail from you.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 I do not like UCE's and I would like to inform you that sending
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 unsolicited messages to someone while he or she may have to pay for
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 reading your message may be illegal. Anyway, it is highly annoying
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 and not welcome by anyone. It is rude, after all.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 If you think that this is a good way to advertise your products or
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 services you are mistaken. Spamming will only make people hate you, not
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 buy from you.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
151 If you have any list of people you send unsolicited commercial emails to,
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
152 REMOVE me from such list immediately. I suggest that you make this list
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 just empty.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
155 ----------------------------------------------------
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
156
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
157 If you are not an administrator of any site and still have received
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
158 this message then your email address is being abused by some spammer.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
159 They fake your address in From: or Reply-To: header. In this case,
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
160 you might want to show this message to your system administrator, and
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
161 ask him/her to investigate this matter.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
162
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 Note to the postmaster(s): I append the text of UCE in question to
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
164 this message; I would like to hear from you about action(s) taken.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 This message has been sent to postmasters at the host that is
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
166 mentioned as original sender's host (I do realize that it may be
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
167 faked, but I think that if your domain name is being abused this way
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
168 you might want to learn about it, and take actions) and to the
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
169 postmaster whose host was used as mail relay for this message. If
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
170 message was sent not by your user, could you please compare time when
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
171 this message was sent (use time in Received: field of the envelope
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
172 rather than Date: field) with your sendmail logs and see what host was
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
173 using your sendmail at this moment of time.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 Thank you."
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176
22462
198054d3498c Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents: 22416
diff changeset
177 "This is the text that `uce-reply-to-uce' command will put in reply buffer.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 Some of spamming programs in use will be set up to read all incoming
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 to spam address email, and will remove people who put the word `remove'
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 on beginning of some line from the spamming list. So, when you set it
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 up, it might be a good idea to actually use this feature.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
183 Value nil means insert no text by default, lets you type it in."
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
184 :type '(choice (const nil) string)
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
185 :group 'uce)
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
187 (defcustom uce-uce-separator
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 "----- original unsolicited commercial email follows -----"
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 "Line that will begin quoting of the UCE.
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
190 Value nil means use no separator."
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
191 :type '(choice (const nil) string)
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
192 :group 'uce)
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
194 (defcustom uce-signature mail-signature
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
195 "Text to put as your signature after the note to UCE sender.
22462
198054d3498c Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents: 22416
diff changeset
196 Value nil means none, t means insert `~/.signature' file (if it happens
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 to exist), if this variable is a string this string will be inserted
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
198 as your signature."
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
199 :type '(choice (const nil) (const t) string)
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
200 :group 'uce)
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
202 (defcustom uce-default-headers
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 "Errors-To: nobody@localhost\nPrecedence: bulk\n"
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 "Additional headers to use when responding to a UCE with \\[uce-reply-to-uce].
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
205 These are mostly meant for headers that prevent delivery errors reporting."
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
206 :type '(choice (const nil) string)
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
207 :group 'uce)
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
209 (defcustom uce-subject-line
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 "Spam alert: unsolicited commercial e-mail"
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
211 "Subject of the message that will be sent in response to a UCE."
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
212 :type 'string
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
213 :group 'uce)
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
215 ;; End of user options.
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
216
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
217
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
218 (defvar rmail-buffer)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
219 (declare-function rmail-msg-is-pruned "rmail" ())
86440
4aedd218aad1 * mail/mspools.el (rmail-get-new-mail):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78232
diff changeset
220 (declare-function mail-strip-quoted-names "mail-utils" (address))
86503
2c08ad76fc1f * progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents: 86440
diff changeset
221 (declare-function rmail-maybe-set-message-counters "rmail" ())
2c08ad76fc1f * progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents: 86440
diff changeset
222 (declare-function rmail-toggle-header "rmail" (&optional arg))
2c08ad76fc1f * progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents: 86440
diff changeset
223
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
224 ;;;###autoload
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 (defun uce-reply-to-uce (&optional ignored)
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
226 "Compose a reply to unsolicited commercial email (UCE).
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
227 Sets up a reply buffer addressed to: the sender, his postmaster,
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
228 his abuse@ address, and the postmaster of the mail relay used.
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
229 You might need to set `uce-mail-reader' before using this."
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
230 (interactive)
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
231 ;; Start of mail-client dependent section.
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
232 (let ((message-buffer
31224
fa7a79afcbf7 (uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents: 23458
diff changeset
233 (cond ((eq uce-mail-reader 'gnus) gnus-original-article-buffer)
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
234 ((eq uce-mail-reader 'rmail) (bound-and-true-p rmail-buffer))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
235 (t (error
43067
858e5cbf508c (uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents: 38401
diff changeset
236 "Variable uce-mail-reader set to unrecognized value"))))
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
237 pruned)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
238 (or (and message-buffer (get-buffer message-buffer))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
239 (error "No mail buffer, cannot find UCE"))
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
240 (switch-to-buffer message-buffer)
43067
858e5cbf508c (uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents: 38401
diff changeset
241 ;; We need the message with headers pruned.
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
242 ;; Why? All we do is get the from and reply-to headers. ?
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
243 (and (eq uce-mail-reader 'rmail)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
244 (not (setq pruned (rmail-msg-is-pruned)))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
245 (rmail-toggle-header 1))
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
246 (let ((to (mail-strip-quoted-names (mail-fetch-field "from" t)))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
247 (reply-to (mail-fetch-field "reply-to"))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
248 temp)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
249 ;; Initial setting of the list of recipients of our message; that's
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
250 ;; what they are pretending to be.
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
251 (setq to (if to
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
252 (format "%s" (mail-strip-quoted-names to))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
253 ""))
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
254 (if reply-to
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
255 (setq to (format "%s, %s" to (mail-strip-quoted-names reply-to))))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
256 (let (first-at-sign end-of-hostname sender-host)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
257 (setq first-at-sign (string-match "@" to)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
258 end-of-hostname (string-match "[ ,>]" to first-at-sign)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
259 sender-host (substring to first-at-sign end-of-hostname))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
260 (if (string-match "\\." sender-host)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
261 (setq to (format "%s, postmaster%s, abuse%s"
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
262 to sender-host sender-host))))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
263 (setq mail-send-actions nil)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
264 (setq mail-reply-buffer nil)
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
265 (when (eq uce-mail-reader 'rmail)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
266 (rmail-toggle-header 0)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
267 (rmail-maybe-set-message-counters)) ; why?
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
268 (copy-region-as-kill (point-min) (point-max))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
269 ;; Restore the initial header state we found.
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
270 (and pruned (rmail-toggle-header 1))
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
271 (switch-to-buffer "*mail*")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
272 (erase-buffer)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
273 (yank)
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
274 (goto-char (point-min))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
275 ;; Delete any internal Rmail headers.
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
276 (when (eq uce-mail-reader 'rmail)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
277 (search-forward "\n\n")
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
278 (while (re-search-backward "^X-RMAIL" nil t)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
279 (delete-region (point) (line-beginning-position 2)))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
280 (goto-char (point-min)))
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
281 ;; Now find the mail hub that first accepted this message.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
282 ;; This should try to find the last Received: header.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
283 ;; Sometimes there may be other headers inbetween Received: headers.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
284 (cond ((eq uce-mail-reader 'gnus)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
285 ;; Does Gnus always have Lines: in the end?
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
286 (re-search-forward "^Lines:")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
287 (beginning-of-line))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
288 ((eq uce-mail-reader 'rmail)
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
289 (search-forward "\n\n")))
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
290 (re-search-backward "^Received:")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
291 ;; Is this always good? It's the only thing I saw when I checked
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
292 ;; a few messages.
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
293 ;;(if (not (re-search-forward ": \\(from\\|by\\) " eol t))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
294 (unless (re-search-forward "\\(from\\|by\\) " (line-end-position) 'move)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
295 (if (looking-at "[ \t\n]+\\(from\\|by\\) ")
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
296 (goto-char (match-end 0))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
297 (error "Failed to extract hub address")))
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
298 (setq temp (point))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
299 (search-forward " ")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
300 (forward-char -1)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
301 ;; And add its postmaster to the list of addresses.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
302 (if (string-match "\\." (buffer-substring temp (point)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
303 (setq to (format "%s, postmaster@%s"
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
304 to (buffer-substring temp (point)))))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
305 ;; Also look at the message-id, it helps *very* often.
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
306 (and (search-forward "\nMessage-Id: " nil t)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
307 ;; Not all Message-Id:'s have an `@' sign.
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
308 (search-forward "@" (line-end-position) t)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
309 (progn
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
310 (setq temp (point))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
311 (search-forward ">")
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
312 (forward-char -1)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
313 (if (string-match "\\." (buffer-substring temp (point)))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
314 (setq to (format "%s, postmaster@%s"
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
315 to (buffer-substring temp (point)))))))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
316 (when (eq uce-mail-reader 'gnus)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
317 ;; Does Gnus always have Lines: in the end?
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
318 (re-search-forward "^Lines:")
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
319 (beginning-of-line)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
320 (setq temp (point))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
321 (search-forward "\n\n" nil t)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
322 (forward-line -1)
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
323 (delete-region temp (point)))
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
324 ;; End of mail-client dependent section.
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
325 (auto-save-mode auto-save-default)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
326 (mail-mode)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
327 (goto-char (point-min))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
328 (insert "To: ")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
329 (save-excursion
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
330 (if to
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
331 (let ((fill-prefix "\t")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
332 (address-start (point)))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
333 (insert to "\n")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
334 (fill-region-as-paragraph address-start (point)))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
335 (newline))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
336 (insert "Subject: " uce-subject-line "\n")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
337 (if uce-default-headers
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
338 (insert uce-default-headers))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
339 (if mail-default-headers
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
340 (insert mail-default-headers))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
341 (if mail-default-reply-to
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
342 (insert "Reply-to: " mail-default-reply-to "\n"))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
343 (insert mail-header-separator "\n")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
344 ;; Insert all our text. Then go back to the place where we started.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
345 (if to (setq to (point)))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
346 ;; Text of ranting.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
347 (if uce-message-text
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
348 (insert uce-message-text))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
349 ;; Signature.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
350 (cond ((eq uce-signature t)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
351 (if (file-exists-p "~/.signature")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
352 (progn
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
353 (insert "\n\n-- \n")
64386
d24c0f192f20 (uce-reply-to-uce): Replace beginning-of-buffer and insert-file.
Richard M. Stallman <rms@gnu.org>
parents: 64085
diff changeset
354 (forward-char (cadr (insert-file-contents "~/.signature"))))))
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
355 (uce-signature
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
356 (insert "\n\n-- \n" uce-signature)))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
357 ;; And text of the original message.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
358 (if uce-uce-separator
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
359 (insert "\n\n" uce-uce-separator "\n"))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
360 ;; If message doesn't end with a newline, insert it.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
361 (goto-char (point-max))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
362 (or (bolp) (newline)))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
363 ;; And go back to the beginning of text.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
364 (if to (goto-char to))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
365 (or to (set-buffer-modified-p nil))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
366 ;; Run hooks before we leave buffer for editing. Reasonable usage
101694
977623d6c580 Tidy up commentary.
Glenn Morris <rgm@gnu.org>
parents: 101393
diff changeset
367 ;; might be to set up special key bindings, replace standard
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
368 ;; functions in mail-mode, etc.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
369 (run-hooks 'mail-setup-hook 'uce-setup-hook))))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
370
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 (defun uce-insert-ranting (&optional ignored)
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 "Insert text of the usual reply to UCE into current buffer."
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 (interactive "P")
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 (insert uce-message-text))
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 (provide 'uce)
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
378 ;; arch-tag: 44b68c87-9b29-47bd-822c-3feee3883221
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 ;;; uce.el ends here