annotate lisp/mail/uce.el @ 90203:187d6a1f84f7

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-71 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 485-492) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 92-94) - Merge from emacs--cvs-trunk--0 - Update from CVS
author Miles Bader <miles@gnu.org>
date Fri, 22 Jul 2005 08:27:27 +0000
parents f9a65d7ebd29 d24c0f192f20
children 2d92f5c9d6ae
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
31224
fa7a79afcbf7 (uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents: 23458
diff changeset
3 ;; Copyright (C) 1996, 1998, 2000 Free Software Foundation, Inc.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
5 ;; Author: stanislav shalunov <shalunov@mccme.ru>
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Created: 10 Dec 1996
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Keywords: uce, unsolicited commercial email
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
38401
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 31224
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 31224
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 31224
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 31224
diff changeset
14 ;; any later version.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
38401
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 31224
diff changeset
16 ;; 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
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 31224
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64d8d90d180d Fix license commentary.
Gerd Moellmann <gerd@gnu.org>
parents: 31224
diff changeset
19 ;; GNU General Public License for more details.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
24 ;; Boston, MA 02110-1301, USA.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; Code in this file provides semi-automatic means of replying to
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
29 ;; UCE's you might get. It works currently only with Rmail and Gnus.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
30 ;; If you would like to make it work with other mail readers,
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
31 ;; Rmail-specific section is marked below. If you want to play with
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
32 ;; code, please let me know about your changes so I can incorporate
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
33 ;; them. I'd appreciate it.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; Function uce-reply-to-uce, if called when current message in RMAIL
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; buffer is a UCE, will setup *mail* buffer in the following way: it
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; scans full headers of message for 1) normal return address of
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; sender (From, Reply-To lines); and puts these addresses into To:
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; header, it also puts abuse@offenders.host address there 2) mailhub
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;; that first saw this message; and puts address of its postmaster
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; into To: header 3) finally, it looks at Message-Id and adds
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; posmaster of that host to the list of addresses.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; Then, we add "Errors-To: nobody@localhost" header, so that if some
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; of these addresses are not actually correct, we will never see
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
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;; Then we put template into buffer (customizable message that
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;; explains what has happened), customizable signature, and the
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; original message with full headers and envelope for postmasters.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 ;; Then buffer is left for editing.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;; The reason that function uce-reply-to-uce is Rmail dependant is
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;; that we want full headers of the original message, nothing
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;; stripped. If we use normal means of inserting of the original
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;; message into *mail* buffer headers like Received: (not really
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; headers, but envelope lines) will be stripped while they bear
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; valuable for us and postmasters information. I do wish that there
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;; would be some way to write this function in some portable way, but
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 ;; I am not aware of any.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;;; Change log:
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;; Dec 10, 1996 -- posted draft version to gnu.sources.emacs
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 ;; Dec 11, 1996 -- fixed some typos, and Francesco Potorti`
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 ;; <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
70 ;; weird, suggested fix, and added let form.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;; Dec 17, 1996 -- made scanning for host names little bit more clever
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ;; (obviously bogus stuff like localhost is now ignored).
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
75 ;; 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
76 ;; <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
77 ;; 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
78
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
79 ;; 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
80 ;; 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
81
31224
fa7a79afcbf7 (uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents: 23458
diff changeset
82 ;; 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
83 ;; <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
84 ;; 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
85 ;; younger than three years.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86
31224
fa7a79afcbf7 (uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents: 23458
diff changeset
87 ;; Setup:
fa7a79afcbf7 (uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents: 23458
diff changeset
88
fa7a79afcbf7 (uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents: 23458
diff changeset
89 ;; Add the following line to your ~/.emacs:
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 ;; (autoload 'uce-reply-to-uce "uce" "Reply to UCEs" t nil)
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
93 ;; If you want to use it with Gnus also use
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
94
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
95 ;; (setq 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
96
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 ;; store this file (uce.el) somewhere in load-path and byte-compile it.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 ;;; Variables:
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 ;; uce-message-text is template that will be inserted into buffer. It
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 ;; has reasonable default. If you want to write some scarier one,
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ;; please do so and send it to me. Please keep it polite.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 ;; uce-signature behaves just like mail-signature. If nil, nothing is
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 ;; inserted, if t, file ~/.signature is used, if a string, its
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 ;; contents are inserted into buffer.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 ;; uce-uce-separator is line that separates your message from the UCE
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 ;; that you enclose.
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 ;; uce-subject-line will be used as subject of outgoing message. If
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 ;; nil, left blank.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 ;;; Code:
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116
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."
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
184 :type 'string
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."
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 17450
diff changeset
206 :type 'string
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
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 (defun uce-reply-to-uce (&optional ignored)
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 "Send reply to UCE in Rmail.
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 UCE stands for unsolicited commercial email. Function will set up reply
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 buffer with default To: to the sender, his postmaster, his abuse@
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 address, and postmaster of the mail relay used."
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
220 (interactive)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
221 (let ((message-buffer
31224
fa7a79afcbf7 (uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents: 23458
diff changeset
222 (cond ((eq uce-mail-reader 'gnus) gnus-original-article-buffer)
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
223 ((eq uce-mail-reader 'rmail) "RMAIL")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
224 (t (error
43067
858e5cbf508c (uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents: 38401
diff changeset
225 "Variable uce-mail-reader set to unrecognized value"))))
858e5cbf508c (uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents: 38401
diff changeset
226 (full-header-p (and (eq uce-mail-reader 'rmail)
858e5cbf508c (uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents: 38401
diff changeset
227 (not (rmail-msg-is-pruned)))))
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
228 (or (get-buffer message-buffer)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
229 (error (concat "No buffer " message-buffer ", cannot find UCE")))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
230 (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
231 ;; We need the message with headers pruned.
858e5cbf508c (uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents: 38401
diff changeset
232 (if full-header-p
858e5cbf508c (uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents: 38401
diff changeset
233 (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
234 (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
235 (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
236 temp)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
237 ;; 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
238 ;; what they are pretending to be.
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 (if to
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
240 (setq to (format "%s" (mail-strip-quoted-names to)))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
241 (setq to ""))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
242 (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
243 (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
244 (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
245 (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
246 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
247 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
248 (if (string-match "\\." sender-host)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
249 (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
250 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
251 (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
252 (setq mail-reply-buffer nil)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
253 (cond ((eq uce-mail-reader 'gnus)
31224
fa7a79afcbf7 (uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents: 23458
diff changeset
254 (copy-region-as-kill (point-min) (point-max)))
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
255 ((eq uce-mail-reader 'rmail)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
256 (save-excursion
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
257 (save-restriction
43387
3a4e24e20c8d (uce-reply-to-uce): Fix incorrect behavior when
Richard M. Stallman <rms@gnu.org>
parents: 43067
diff changeset
258 (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
259 (widen)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
260 (rmail-maybe-set-message-counters)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
261 (copy-region-as-kill (rmail-msgbeg rmail-current-message)
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
262 (rmail-msgend rmail-current-message))))))
43067
858e5cbf508c (uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents: 38401
diff changeset
263 ;; Restore the pruned header state we found.
858e5cbf508c (uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents: 38401
diff changeset
264 (if full-header-p
858e5cbf508c (uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents: 38401
diff changeset
265 (rmail-toggle-header 0))
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
266 (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
267 (erase-buffer)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
268 (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
269 (yank)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
270 (goto-char temp)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
271 (if (eq uce-mail-reader 'rmail)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
272 (progn
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
273 (forward-line 2)
23458
f68b71f7b9fd (uce-reply-to-uce): Bind case-fold-search.
Richard M. Stallman <rms@gnu.org>
parents: 22462
diff changeset
274 (let ((case-fold-search t))
f68b71f7b9fd (uce-reply-to-uce): Bind case-fold-search.
Richard M. Stallman <rms@gnu.org>
parents: 22462
diff changeset
275 (while (looking-at "Summary-Line:\\|Mail-From:")
f68b71f7b9fd (uce-reply-to-uce): Bind case-fold-search.
Richard M. Stallman <rms@gnu.org>
parents: 22462
diff changeset
276 (forward-line 1)))
22416
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
277 (delete-region temp (point))))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
278 ;; 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
279 ;; 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
280 ;; 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
281 (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
282 ;; 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
283 (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
284 (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
285 ((eq uce-mail-reader 'rmail)
64386
d24c0f192f20 (uce-reply-to-uce): Replace beginning-of-buffer and insert-file.
Richard M. Stallman <rms@gnu.org>
parents: 64085
diff changeset
286 (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
287 (search-forward "*** EOOH ***\n")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
288 (beginning-of-line)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
289 (forward-line -1)))
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 (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
292 ;; 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
293 ;; a few messages.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
294 (let ((eol (save-excursion (end-of-line) (point))))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
295 ;;(if (not (re-search-forward ": \\(from\\|by\\) " eol t))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
296 (if (not (re-search-forward "\\(from\\|by\\) " eol t))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
297 (progn
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
298 (goto-char eol)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
299 (if (looking-at "[ \t\n]+\\(from\\|by\\) ")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
300 (goto-char (match-end 0))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
301 (error "Failed to extract hub address")))))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
302 (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
303 (search-forward " ")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
304 (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
305 ;; 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
306 (if (string-match "\\." (buffer-substring temp (point)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
307 (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
308 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
309 ;; Also look at the message-id, it helps *very* often.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
310 (if (and (search-forward "\nMessage-Id: " nil t)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
311 ;; Not all Message-Id:'s have an `@' sign.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
312 (let ((bol (point))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
313 eol)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
314 (end-of-line)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
315 (setq eol (point))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
316 (goto-char bol)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
317 (search-forward "@" eol t)))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
318 (progn
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
319 (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
320 (search-forward ">")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
321 (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
322 (if (string-match "\\." (buffer-substring temp (point)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
323 (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
324 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
325 (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
326 ;; 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
327 (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
328 (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
329 ((eq uce-mail-reader 'rmail)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
330 (search-forward "\n*** EOOH ***\n")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
331 (forward-line -1)))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
332 (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
333 (search-forward "\n\n" nil t)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
334 (if (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
335 (forward-line -1))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
336 (delete-region temp (point))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
337 ;; End of Rmail dependent section.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
338 (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
339 (mail-mode)
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
340 (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
341 (insert "To: ")
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
342 (save-excursion
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
343 (if to
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
344 (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
345 (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
346 (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
347 (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
348 (newline))
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
349 (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
350 (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
351 (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
352 (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
353 (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
354 (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
355 (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
356 (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
357 ;; 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
358 (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
359 ;; 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
360 (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
361 (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
362 ;; Signature.
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
363 (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
364 (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
365 (progn
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
366 (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
367 (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
368 (uce-signature
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
369 (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
370 ;; 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
371 (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
372 (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
373 ;; 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
374 (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
375 (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
376 ;; 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
377 (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
378 (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
379 ;; Run hooks before we leave buffer for editing. Reasonable usage
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
380 ;; might be to set up special key bindings, replace standart
a517da228cb9 (uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents: 21918
diff changeset
381 ;; 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
382 (run-hooks 'mail-setup-hook 'uce-setup-hook))))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 43387
diff changeset
383
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 (defun uce-insert-ranting (&optional ignored)
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 "Insert text of the usual reply to UCE into current buffer."
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 (interactive "P")
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 (insert uce-message-text))
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 (provide 'uce)
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49598
diff changeset
391 ;;; arch-tag: 44b68c87-9b29-47bd-822c-3feee3883221
17450
bbf1df3de440 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 ;;; uce.el ends here