]> code.delx.au - gnu-emacs/blob - lisp/mail/smtpmail.el
(mh-quit): Undo 3/3 change (and the subsequent fix).
[gnu-emacs] / lisp / mail / smtpmail.el
1 ;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail
2
3 ;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
4
5 ;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp>
6 ;; Maintainer: Brian D. Carlstrom <bdc@ai.mit.edu>
7 ;; ESMTP support: Simon Leinen <simon@switch.ch>
8 ;; Keywords: mail
9
10 ;; This file is part of GNU Emacs.
11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
16
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
26
27 ;;; Commentary:
28
29 ;; Send Mail to smtp host from smtpmail temp buffer.
30
31 ;; Please add these lines in your .emacs(_emacs).
32 ;;
33 ;;(setq send-mail-function 'smtpmail-send-it)
34 ;;(setq smtpmail-default-smtp-server "YOUR SMTP HOST")
35 ;;(setq smtpmail-smtp-service "smtp")
36 ;;(setq smtpmail-local-domain "YOUR DOMAIN NAME")
37 ;;(setq smtpmail-debug-info t)
38 ;;(load-library "smtpmail")
39 ;;(setq smtpmail-code-conv-from nil)
40 ;;(setq user-full-name "YOUR NAME HERE")
41
42 ;; To queue mail, set smtpmail-queue-mail to t and use
43 ;; smtpmail-send-queued-mail to send.
44
45
46 ;;; Code:
47
48 (require 'sendmail)
49 (require 'time-stamp)
50
51 ;;;
52 (defgroup smtpmail nil
53 "SMTP protocol for sending mail."
54 :group 'mail)
55
56
57 (defcustom smtpmail-default-smtp-server nil
58 "*Specify default SMTP server."
59 :type '(choice (const nil) string)
60 :group 'smtpmail)
61
62 (defcustom smtpmail-smtp-server
63 (or (getenv "SMTPSERVER") smtpmail-default-smtp-server)
64 "*The name of the host running SMTP server."
65 :type '(choice (const nil) string)
66 :group 'smtpmail)
67
68 (defcustom smtpmail-smtp-service 25
69 "*SMTP service port number. smtp or 25 ."
70 :type 'integer
71 :group 'smtpmail)
72
73 (defcustom smtpmail-local-domain nil
74 "*Local domain name without a host name.
75 If the function (system-name) returns the full internet address,
76 don't define this value."
77 :type '(choice (const nil) string)
78 :group 'smtpmail)
79
80 (defcustom smtpmail-debug-info nil
81 "*smtpmail debug info printout. messages and process buffer."
82 :type 'boolean
83 :group 'smtpmail)
84
85 (defcustom smtpmail-code-conv-from nil ;; *junet*
86 "*smtpmail code convert from this code to *internal*..for tiny-mime.."
87 :type 'boolean
88 :group 'smtpmail)
89
90 (defcustom smtpmail-queue-mail nil
91 "*Specify if mail is queued (if t) or sent immediately (if nil).
92 If queued, it is stored in the directory `smtpmail-queue-dir'
93 and sent with `smtpmail-send-queued-mail'."
94 :type 'boolean
95 :group 'smtpmail)
96
97 (defcustom smtpmail-queue-dir "~/Mail/queued-mail/"
98 "*Directory where `smtpmail.el' stores queued mail."
99 :type 'directory
100 :group 'smtpmail)
101
102 (defvar smtpmail-queue-index-file "index"
103 "File name of queued mail index,
104 This is relative to `smtpmail-queue-dir'.")
105
106 (defvar smtpmail-queue-index (concat smtpmail-queue-dir
107 smtpmail-queue-index-file))
108
109 ;;;
110 ;;;
111 ;;;
112
113 (defun smtpmail-send-it ()
114 (require 'mail-utils)
115 (let ((errbuf (if mail-interactive
116 (generate-new-buffer " smtpmail errors")
117 0))
118 (tembuf (generate-new-buffer " smtpmail temp"))
119 (case-fold-search nil)
120 delimline
121 (mailbuf (current-buffer)))
122 (unwind-protect
123 (save-excursion
124 (set-buffer tembuf)
125 (erase-buffer)
126 (insert-buffer-substring mailbuf)
127 (goto-char (point-max))
128 ;; require one newline at the end.
129 (or (= (preceding-char) ?\n)
130 (insert ?\n))
131 ;; Change header-delimiter to be what sendmail expects.
132 (mail-sendmail-undelimit-header)
133 (setq delimline (point-marker))
134 ;; (sendmail-synch-aliases)
135 (if mail-aliases
136 (expand-mail-aliases (point-min) delimline))
137 (goto-char (point-min))
138 ;; ignore any blank lines in the header
139 (while (and (re-search-forward "\n\n\n*" delimline t)
140 (< (point) delimline))
141 (replace-match "\n"))
142 (let ((case-fold-search t))
143 ;; We used to process Resent-... headers here,
144 ;; but it was not done properly, and the job
145 ;; is done correctly in smtpmail-deduce-address-list.
146 ;; Don't send out a blank subject line
147 (goto-char (point-min))
148 (if (re-search-forward "^Subject:\\([ \t]*\n\\)+\\b" delimline t)
149 (replace-match "")
150 ;; This one matches a Subject just before the header delimiter.
151 (if (and (re-search-forward "^Subject:\\([ \t]*\n\\)+" delimline t)
152 (= (match-end 0) delimline))
153 (replace-match "")))
154 ;; Put the "From:" field in unless for some odd reason
155 ;; they put one in themselves.
156 (goto-char (point-min))
157 (if (not (re-search-forward "^From:" delimline t))
158 (let* ((login user-mail-address)
159 (fullname (user-full-name)))
160 (cond ((eq mail-from-style 'angles)
161 (insert "From: " fullname)
162 (let ((fullname-start (+ (point-min) 6))
163 (fullname-end (point-marker)))
164 (goto-char fullname-start)
165 ;; Look for a character that cannot appear unquoted
166 ;; according to RFC 822.
167 (if (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]"
168 fullname-end 1)
169 (progn
170 ;; Quote fullname, escaping specials.
171 (goto-char fullname-start)
172 (insert "\"")
173 (while (re-search-forward "[\"\\]"
174 fullname-end 1)
175 (replace-match "\\\\\\&" t))
176 (insert "\""))))
177 (insert " <" login ">\n"))
178 ((eq mail-from-style 'parens)
179 (insert "From: " login " (")
180 (let ((fullname-start (point)))
181 (insert fullname)
182 (let ((fullname-end (point-marker)))
183 (goto-char fullname-start)
184 ;; RFC 822 says \ and nonmatching parentheses
185 ;; must be escaped in comments.
186 ;; Escape every instance of ()\ ...
187 (while (re-search-forward "[()\\]" fullname-end 1)
188 (replace-match "\\\\\\&" t))
189 ;; ... then undo escaping of matching parentheses,
190 ;; including matching nested parentheses.
191 (goto-char fullname-start)
192 (while (re-search-forward
193 "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)"
194 fullname-end 1)
195 (replace-match "\\1(\\3)" t)
196 (goto-char fullname-start))))
197 (insert ")\n"))
198 ((null mail-from-style)
199 (insert "From: " login "\n")))))
200 ;; Insert an extra newline if we need it to work around
201 ;; Sun's bug that swallows newlines.
202 (goto-char (1+ delimline))
203 (if (eval mail-mailer-swallows-blank-line)
204 (newline))
205 ;; Find and handle any FCC fields.
206 (goto-char (point-min))
207 (if (re-search-forward "^FCC:" delimline t)
208 (mail-do-fcc delimline))
209 (if mail-interactive
210 (save-excursion
211 (set-buffer errbuf)
212 (erase-buffer))))
213 ;;
214 ;;
215 ;;
216 (setq smtpmail-address-buffer (generate-new-buffer "*smtp-mail*"))
217 (setq smtpmail-recipient-address-list
218 (smtpmail-deduce-address-list tembuf (point-min) delimline))
219 (kill-buffer smtpmail-address-buffer)
220
221 (smtpmail-do-bcc delimline)
222 ; Send or queue
223 (if (not smtpmail-queue-mail)
224 (if (not (null smtpmail-recipient-address-list))
225 (if (not (smtpmail-via-smtp
226 smtpmail-recipient-address-list tembuf))
227 (error "Sending failed; SMTP protocol error"))
228 (error "Sending failed; no recipients"))
229 (let* ((file-data (concat
230 smtpmail-queue-dir
231 (concat (time-stamp-yyyy-mm-dd)
232 "_" (time-stamp-hh:mm:ss))))
233 (file-elisp (concat file-data ".el"))
234 (buffer-data (create-file-buffer file-data))
235 (buffer-elisp (create-file-buffer file-elisp))
236 (buffer-scratch "*queue-mail*"))
237 (save-excursion
238 (set-buffer buffer-data)
239 (erase-buffer)
240 (insert-buffer tembuf)
241 (write-file file-data)
242 (set-buffer buffer-elisp)
243 (erase-buffer)
244 (insert (concat
245 "(setq smtpmail-recipient-address-list '"
246 (prin1-to-string smtpmail-recipient-address-list)
247 ")\n"))
248 (write-file file-elisp)
249 (set-buffer (generate-new-buffer buffer-scratch))
250 (insert (concat file-data "\n"))
251 (append-to-file (point-min)
252 (point-max)
253 smtpmail-queue-index)
254 )
255 (kill-buffer buffer-scratch)
256 (kill-buffer buffer-data)
257 (kill-buffer buffer-elisp))))
258 (kill-buffer tembuf)
259 (if (bufferp errbuf)
260 (kill-buffer errbuf)))))
261
262 (defun smtpmail-send-queued-mail ()
263 "Send mail that was queued as a result of setting `smtpmail-queue-mail'."
264 (interactive)
265 ;;; Get index, get first mail, send it, get second mail, etc...
266 (let ((buffer-index (find-file-noselect smtpmail-queue-index))
267 (file-msg "")
268 (tembuf nil))
269 (save-excursion
270 (set-buffer buffer-index)
271 (beginning-of-buffer)
272 (while (not (eobp))
273 (setq file-msg (buffer-substring (point) (save-excursion
274 (end-of-line)
275 (point))))
276 (load file-msg)
277 (setq tembuf (find-file-noselect file-msg))
278 (if (not (null smtpmail-recipient-address-list))
279 (if (not (smtpmail-via-smtp smtpmail-recipient-address-list
280 tembuf))
281 (error "Sending failed; SMTP protocol error"))
282 (error "Sending failed; no recipients"))
283 (delete-file file-msg)
284 (delete-file (concat file-msg ".el"))
285 (kill-buffer tembuf)
286 (kill-line 1))
287 (set-buffer buffer-index)
288 (save-buffer smtpmail-queue-index)
289 (kill-buffer buffer-index)
290 )))
291
292 ;(defun smtpmail-via-smtp (host,port,sender,destination,smtpmail-text-buffer)
293
294 (defun smtpmail-fqdn ()
295 (if smtpmail-local-domain
296 (concat (system-name) "." smtpmail-local-domain)
297 (system-name)))
298
299 (defun smtpmail-via-smtp (recipient smtpmail-text-buffer)
300 (let ((process nil)
301 (host smtpmail-smtp-server)
302 (port smtpmail-smtp-service)
303 response-code
304 greeting
305 process-buffer
306 (supported-extensions '()))
307 (unwind-protect
308 (catch 'done
309 ;; get or create the trace buffer
310 (setq process-buffer
311 (get-buffer-create (format "*trace of SMTP session to %s*" host)))
312
313 ;; clear the trace buffer of old output
314 (save-excursion
315 (set-buffer process-buffer)
316 (erase-buffer))
317
318 ;; open the connection to the server
319 (setq process (open-network-stream "SMTP" process-buffer host port))
320 (and (null process) (throw 'done nil))
321
322 ;; set the send-filter
323 (set-process-filter process 'smtpmail-process-filter)
324
325 (save-excursion
326 (set-buffer process-buffer)
327 (make-local-variable 'smtpmail-read-point)
328 (setq smtpmail-read-point (point-min))
329
330
331 (if (or (null (car (setq greeting (smtpmail-read-response process))))
332 (not (integerp (car greeting)))
333 (>= (car greeting) 400))
334 (throw 'done nil)
335 )
336
337 ;; EHLO
338 (smtpmail-send-command process (format "EHLO %s" (smtpmail-fqdn)))
339
340 (if (or (null (car (setq response-code (smtpmail-read-response process))))
341 (not (integerp (car response-code)))
342 (>= (car response-code) 400))
343 (progn
344 ;; HELO
345 (smtpmail-send-command process (format "HELO %s" (smtpmail-fqdn)))
346
347 (if (or (null (car (setq response-code (smtpmail-read-response process))))
348 (not (integerp (car response-code)))
349 (>= (car response-code) 400))
350 (throw 'done nil)))
351 (let ((extension-lines (cdr (cdr response-code))))
352 (while extension-lines
353 (let ((name (intern (downcase (substring (car extension-lines) 4)))))
354 (and name
355 (cond ((memq name '(verb xvrb 8bitmime onex xone
356 expn size dsn etrn
357 help xusr))
358 (setq supported-extensions
359 (cons name supported-extensions)))
360 (t (message "unknown extension %s"
361 name)))))
362 (setq extension-lines (cdr extension-lines)))))
363
364 (if (or (member 'onex supported-extensions)
365 (member 'xone supported-extensions))
366 (progn
367 (smtpmail-send-command process (format "ONEX"))
368 (if (or (null (car (setq response-code (smtpmail-read-response process))))
369 (not (integerp (car response-code)))
370 (>= (car response-code) 400))
371 (throw 'done nil))))
372
373 (if (and smtpmail-debug-info
374 (or (member 'verb supported-extensions)
375 (member 'xvrb supported-extensions)))
376 (progn
377 (smtpmail-send-command process (format "VERB"))
378 (if (or (null (car (setq response-code (smtpmail-read-response process))))
379 (not (integerp (car response-code)))
380 (>= (car response-code) 400))
381 (throw 'done nil))))
382
383 (if (member 'xusr supported-extensions)
384 (progn
385 (smtpmail-send-command process (format "XUSR"))
386 (if (or (null (car (setq response-code (smtpmail-read-response process))))
387 (not (integerp (car response-code)))
388 (>= (car response-code) 400))
389 (throw 'done nil))))
390
391 ;; MAIL FROM: <sender>
392 (let ((size-part
393 (if (member 'size supported-extensions)
394 (format " SIZE=%d"
395 (save-excursion
396 (set-buffer smtpmail-text-buffer)
397 ;; size estimate:
398 (+ (- (point-max) (point-min))
399 ;; Add one byte for each change-of-line
400 ;; because or CR-LF representation:
401 (count-lines (point-min) (point-max))
402 ;; For some reason, an empty line is
403 ;; added to the message. Maybe this
404 ;; is a bug, but it can't hurt to add
405 ;; those two bytes anyway:
406 2)))
407 ""))
408 (body-part
409 (if (member '8bitmime supported-extensions)
410 ;; FIXME:
411 ;; Code should be added here that transforms
412 ;; the contents of the message buffer into
413 ;; something the receiving SMTP can handle.
414 ;; For a receiver that supports 8BITMIME, this
415 ;; may mean converting BINARY to BASE64, or
416 ;; adding Content-Transfer-Encoding and the
417 ;; other MIME headers. The code should also
418 ;; return an indication of what encoding the
419 ;; message buffer is now, i.e. ASCII or
420 ;; 8BITMIME.
421 (if nil
422 " BODY=8BITMIME"
423 "")
424 "")))
425 ; (smtpmail-send-command process (format "MAIL FROM:%s@%s" (user-login-name) (smtpmail-fqdn)))
426 (smtpmail-send-command process (format "MAIL FROM: <%s>%s%s"
427 user-mail-address
428 size-part
429 body-part))
430
431 (if (or (null (car (setq response-code (smtpmail-read-response process))))
432 (not (integerp (car response-code)))
433 (>= (car response-code) 400))
434 (throw 'done nil)
435 ))
436
437 ;; RCPT TO: <recipient>
438 (let ((n 0))
439 (while (not (null (nth n recipient)))
440 (smtpmail-send-command process (format "RCPT TO: <%s>" (nth n recipient)))
441 (setq n (1+ n))
442
443 (setq response-code (smtpmail-read-response process))
444 (if (or (null (car response-code))
445 (not (integerp (car response-code)))
446 (>= (car response-code) 400))
447 (throw 'done nil)
448 )
449 ))
450
451 ;; DATA
452 (smtpmail-send-command process "DATA")
453
454 (if (or (null (car (setq response-code (smtpmail-read-response process))))
455 (not (integerp (car response-code)))
456 (>= (car response-code) 400))
457 (throw 'done nil)
458 )
459
460 ;; Mail contents
461 (smtpmail-send-data process smtpmail-text-buffer)
462
463 ;;DATA end "."
464 (smtpmail-send-command process ".")
465
466 (if (or (null (car (setq response-code (smtpmail-read-response process))))
467 (not (integerp (car response-code)))
468 (>= (car response-code) 400))
469 (throw 'done nil)
470 )
471
472 ;;QUIT
473 ; (smtpmail-send-command process "QUIT")
474 ; (and (null (car (smtpmail-read-response process)))
475 ; (throw 'done nil))
476 t ))
477 (if process
478 (save-excursion
479 (set-buffer (process-buffer process))
480 (smtpmail-send-command process "QUIT")
481 (smtpmail-read-response process)
482
483 ; (if (or (null (car (setq response-code (smtpmail-read-response process))))
484 ; (not (integerp (car response-code)))
485 ; (>= (car response-code) 400))
486 ; (throw 'done nil)
487 ; )
488 (delete-process process))))))
489
490
491 (defun smtpmail-process-filter (process output)
492 (save-excursion
493 (set-buffer (process-buffer process))
494 (goto-char (point-max))
495 (insert output)))
496
497 (defun smtpmail-read-response (process)
498 (let ((case-fold-search nil)
499 (response-strings nil)
500 (response-continue t)
501 (return-value '(nil ()))
502 match-end)
503
504 (while response-continue
505 (goto-char smtpmail-read-point)
506 (while (not (search-forward "\r\n" nil t))
507 (accept-process-output process)
508 (goto-char smtpmail-read-point))
509
510 (setq match-end (point))
511 (setq response-strings
512 (cons (buffer-substring smtpmail-read-point (- match-end 2))
513 response-strings))
514
515 (goto-char smtpmail-read-point)
516 (if (looking-at "[0-9]+ ")
517 (let ((begin (match-beginning 0))
518 (end (match-end 0)))
519 (if smtpmail-debug-info
520 (message "%s" (car response-strings)))
521
522 (setq smtpmail-read-point match-end)
523
524 ;; ignore lines that start with "0"
525 (if (looking-at "0[0-9]+ ")
526 nil
527 (setq response-continue nil)
528 (setq return-value
529 (cons (string-to-int
530 (buffer-substring begin end))
531 (nreverse response-strings)))))
532
533 (if (looking-at "[0-9]+-")
534 (progn (if smtpmail-debug-info
535 (message "%s" (car response-strings)))
536 (setq smtpmail-read-point match-end)
537 (setq response-continue t))
538 (progn
539 (setq smtpmail-read-point match-end)
540 (setq response-continue nil)
541 (setq return-value
542 (cons nil (nreverse response-strings)))
543 )
544 )))
545 (setq smtpmail-read-point match-end)
546 return-value))
547
548
549 (defun smtpmail-send-command (process command)
550 (goto-char (point-max))
551 (if (= (aref command 0) ?P)
552 (insert "PASS <omitted>\r\n")
553 (insert command "\r\n"))
554 (setq smtpmail-read-point (point))
555 (process-send-string process command)
556 (process-send-string process "\r\n"))
557
558 (defun smtpmail-send-data-1 (process data)
559 (goto-char (point-max))
560
561 (if (not (null smtpmail-code-conv-from))
562 (setq data (code-convert-string data smtpmail-code-conv-from *internal*)))
563
564 (if smtpmail-debug-info
565 (insert data "\r\n"))
566
567 (setq smtpmail-read-point (point))
568 ;; Escape "." at start of a line
569 (if (eq (string-to-char data) ?.)
570 (process-send-string process "."))
571 (process-send-string process data)
572 (process-send-string process "\r\n")
573 )
574
575 (defun smtpmail-send-data (process buffer)
576 (let
577 ((data-continue t)
578 (sending-data nil)
579 this-line
580 this-line-end)
581
582 (save-excursion
583 (set-buffer buffer)
584 (goto-char (point-min)))
585
586 (while data-continue
587 (save-excursion
588 (set-buffer buffer)
589 (beginning-of-line)
590 (setq this-line (point))
591 (end-of-line)
592 (setq this-line-end (point))
593 (setq sending-data nil)
594 (setq sending-data (buffer-substring this-line this-line-end))
595 (if (/= (forward-line 1) 0)
596 (setq data-continue nil)))
597
598 (smtpmail-send-data-1 process sending-data)
599 )
600 )
601 )
602
603
604 (defun smtpmail-deduce-address-list (smtpmail-text-buffer header-start header-end)
605 "Get address list suitable for smtp RCPT TO: <address>."
606 (require 'mail-utils) ;; pick up mail-strip-quoted-names
607 (let
608 ((case-fold-search t)
609 (simple-address-list "")
610 this-line
611 this-line-end
612 addr-regexp)
613
614 (unwind-protect
615 (save-excursion
616 ;;
617 (set-buffer smtpmail-address-buffer) (erase-buffer)
618 (insert-buffer-substring smtpmail-text-buffer header-start header-end)
619 (goto-char (point-min))
620 ;; RESENT-* fields should stop processing of regular fields.
621 (save-excursion
622 (if (re-search-forward "^Resent-\\(to\\|cc\\|bcc\\):" header-end t)
623 (setq addr-regexp "^Resent-\\(to\\|cc\\|bcc\\):")
624 (setq addr-regexp "^\\(To:\\|Cc:\\|Bcc:\\)")))
625
626 (while (re-search-forward addr-regexp header-end t)
627 (replace-match "")
628 (setq this-line (match-beginning 0))
629 (forward-line 1)
630 ;; get any continuation lines
631 (while (and (looking-at "^[ \t]+") (< (point) header-end))
632 (forward-line 1))
633 (setq this-line-end (point-marker))
634 (setq simple-address-list
635 (concat simple-address-list " "
636 (mail-strip-quoted-names (buffer-substring this-line this-line-end))))
637 )
638 (erase-buffer)
639 (insert-string " ")
640 (insert-string simple-address-list)
641 (insert-string "\n")
642 (subst-char-in-region (point-min) (point-max) 10 ? t);; newline --> blank
643 (subst-char-in-region (point-min) (point-max) ?, ? t);; comma --> blank
644 (subst-char-in-region (point-min) (point-max) 9 ? t);; tab --> blank
645
646 (goto-char (point-min))
647 ;; tidyness in case hook is not robust when it looks at this
648 (while (re-search-forward "[ \t]+" header-end t) (replace-match " "))
649
650 (goto-char (point-min))
651 (let (recipient-address-list)
652 (while (re-search-forward " \\([^ ]+\\) " (point-max) t)
653 (backward-char 1)
654 (setq recipient-address-list (cons (buffer-substring (match-beginning 1) (match-end 1))
655 recipient-address-list))
656 )
657 (setq smtpmail-recipient-address-list recipient-address-list))
658
659 )
660 )
661 )
662 )
663
664
665 (defun smtpmail-do-bcc (header-end)
666 "Delete [Resent-]BCC: and their continuation lines from the header area.
667 There may be multiple BCC: lines, and each may have arbitrarily
668 many continuation lines."
669 (let ((case-fold-search t))
670 (save-excursion (goto-char (point-min))
671 ;; iterate over all BCC: lines
672 (while (re-search-forward "^\(RESENT-\)?BCC:" header-end t)
673 (delete-region (match-beginning 0) (progn (forward-line 1) (point)))
674 ;; get rid of any continuation lines
675 (while (and (looking-at "^[ \t].*\n") (< (point) header-end))
676 (replace-match ""))
677 )
678 ) ;; save-excursion
679 ) ;; let
680 )
681
682
683
684 (provide 'smtpmail)
685
686 ;;; smtpmail.el ends here