From: handa Date: Sat, 12 Aug 2000 02:10:04 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: semi21-2000-08-12~2 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=b53f8e9f39a63b564ff6385a0ee8a8c182846295;p=elisp%2Flemi.git *** empty log message *** --- diff --git a/mail/feedmail.el b/mail/feedmail.el index 6ddb0b5..a2bd81d 100644 --- a/mail/feedmail.el +++ b/mail/feedmail.el @@ -1352,15 +1352,15 @@ complicated cases." ;; I'm not sure smtpmail.el is careful about the following ;; return value, but it also uses it internally, so I will fear ;; no evil. - (require 'smtpmail) - (if (not (smtpmail-via-smtp addr-listoid prepped)) + (require 'smtp) + (if (not (smtp-via-smtp user-mail-address addr-listoid prepped)) (progn (set-buffer errors-to) (insert "Send via smtpmail failed. Probable SMTP protocol error.\n") (insert "Look for details below or in the *Messages* buffer.\n\n") (let ((case-fold-search t) ;; don't be overconfident about the name of the trace buffer - (tracer (concat "trace.*smtp.*" (regexp-quote smtpmail-smtp-server)))) + (tracer (concat "trace.*smtp.*" (regexp-quote smtp-server)))) (mapcar '(lambda (buffy) (if (string-match tracer (buffer-name buffy)) diff --git a/mail/smtpmail.el b/mail/smtpmail.el index 6f53489..74638aa 100644 --- a/mail/smtpmail.el +++ b/mail/smtpmail.el @@ -1,43 +1,40 @@ -;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail -;;; ### Hacked by Mike Taylor, 11th October 1999 to add support for -;;; automatically appending a domain to RCPT TO: addresses. +;;; smtpmail.el --- SMTP interface for mail-mode -;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. +;; Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc. ;; Author: Tomoji Kagatani -;; Maintainer: Brian D. Carlstrom -;; ESMTP support: Simon Leinen ;; Keywords: mail -;; This file is part of GNU Emacs. +;; This file is part of FLIM (Faithful Library about Internet Message). -;; GNU Emacs is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;; Send Mail to smtp host from smtpmail temp buffer. -;; Please add these lines in your .emacs(_emacs) or use customize. +;; Please add these lines in your .emacs(_emacs). ;; -;;(setq send-mail-function 'smtpmail-send-it) ; if you use `mail' -;;(setq message-send-mail-function 'smtpmail-send-it) ; if you use `message' -;;(setq smtpmail-default-smtp-server "YOUR SMTP HOST") -;;(setq smtpmail-local-domain "YOUR DOMAIN NAME") -;;(setq smtpmail-sendto-domain "YOUR DOMAIN NAME") -;;(setq smtpmail-debug-info t) ; only to debug problems +;;(setq send-mail-function 'smtpmail-send-it) +;;(setq smtp-default-server "YOUR SMTP HOST") +;;(setq smtp-service "smtp") +;;(setq smtp-local-domain "YOUR DOMAIN NAME") +;;(setq smtp-debug-info t) +;;(autoload 'smtpmail-send-it "smtpmail") +;;(setq user-full-name "YOUR NAME HERE") ;; To queue mail, set smtpmail-queue-mail to t and use ;; smtpmail-send-queued-mail to send. @@ -45,94 +42,47 @@ ;;; Code: +(require 'poe) +(require 'pcustom) +(require 'smtp) (require 'sendmail) (require 'time-stamp) -;;; -(defgroup smtpmail nil - "SMTP protocol for sending mail." - :group 'mail) - - -(defcustom smtpmail-default-smtp-server nil - "*Specify default SMTP server." - :type '(choice (const nil) string) - :group 'smtpmail) - -(defcustom smtpmail-smtp-server - (or (getenv "SMTPSERVER") smtpmail-default-smtp-server) - "*The name of the host running SMTP server." - :type '(choice (const nil) string) - :group 'smtpmail) - -(defcustom smtpmail-smtp-service 25 - "*SMTP service port number. smtp or 25 ." - :type 'integer - :group 'smtpmail) - -(defcustom smtpmail-local-domain nil - "*Local domain name without a host name. -If the function (system-name) returns the full internet address, -don't define this value." - :type '(choice (const nil) string) - :group 'smtpmail) - -(defcustom smtpmail-sendto-domain nil - "*Local domain name without a host name. -This is appended (with an @-sign) to any specified recipients which do -not include an @-sign, so that each RCPT TO address is fully qualified. -\(Some configurations of sendmail require this.) - -Don't bother to set this unless you have get an error like: - Sending failed; SMTP protocol error -when sending mail, and the *trace of SMTP session to * -buffer includes an exchange like: - RCPT TO: - 501 : recipient address must contain a domain -" - :type '(choice (const nil) string) - :group 'smtpmail) - -(defun maybe-append-domain (recipient) - (if (or (not smtpmail-sendto-domain) - (string-match "@" recipient)) - recipient - (concat recipient "@" smtpmail-sendto-domain))) - -(defcustom smtpmail-debug-info nil - "*smtpmail debug info printout. messages and process buffer." - :type 'boolean - :group 'smtpmail) +(eval-when-compile (require 'static)) -(defcustom smtpmail-code-conv-from nil ;; *junet* - "*smtpmail code convert from this code to *internal*..for tiny-mime.." - :type 'boolean - :group 'smtpmail) +(static-when (featurep 'xemacs) + (define-obsolete-variable-alias 'smtpmail-default-smtp-server + 'smtp-default-server) + (define-obsolete-variable-alias 'smtpmail-smtp-server 'smtp-server) + (define-obsolete-variable-alias 'smtpmail-smtp-service 'smtp-service) + (define-obsolete-variable-alias 'smtpmail-local-domain 'smtp-local-domain) + (define-obsolete-variable-alias 'smtpmail-debug-info 'smtp-debug-info) + ) + +;;; (defcustom smtpmail-queue-mail nil - "*Specify if mail is queued (if t) or sent immediately (if nil). + "Specify if mail is queued (if t) or sent immediately (if nil). If queued, it is stored in the directory `smtpmail-queue-dir' and sent with `smtpmail-send-queued-mail'." :type 'boolean - :group 'smtpmail) + :group 'smtp) (defcustom smtpmail-queue-dir "~/Mail/queued-mail/" - "*Directory where `smtpmail.el' stores queued mail." + "Directory where `smtpmail.el' stores queued mail." :type 'directory - :group 'smtpmail) + :group 'smtp) (defvar smtpmail-queue-index-file "index" "File name of queued mail index, This is relative to `smtpmail-queue-dir'.") -(defvar smtpmail-address-buffer) -(defvar smtpmail-recipient-address-list) +(defvar smtpmail-queue-index + (concat (file-name-as-directory smtpmail-queue-dir) + smtpmail-queue-index-file)) -;; Buffer-local variable. -(defvar smtpmail-read-point) +(defvar smtpmail-recipient-address-list nil) -(defvar smtpmail-queue-index (concat smtpmail-queue-dir - smtpmail-queue-index-file)) ;;; ;;; @@ -146,12 +96,9 @@ This is relative to `smtpmail-queue-dir'.") 0)) (tembuf (generate-new-buffer " smtpmail temp")) (case-fold-search nil) + resend-to-addresses delimline - (mailbuf (current-buffer)) - (smtpmail-code-conv-from - (if enable-multibyte-characters - (let ((sendmail-coding-system smtpmail-code-conv-from)) - (select-message-coding-system))))) + (mailbuf (current-buffer))) (unwind-protect (save-excursion (set-buffer tembuf) @@ -162,10 +109,14 @@ This is relative to `smtpmail-queue-dir'.") (or (= (preceding-char) ?\n) (insert ?\n)) ;; Change header-delimiter to be what sendmail expects. - (mail-sendmail-undelimit-header) + (goto-char (point-min)) + (re-search-forward + (concat "^" (regexp-quote mail-header-separator) "\n")) + (replace-match "\n") + (backward-char 1) (setq delimline (point-marker)) ;; (sendmail-synch-aliases) - (if mail-aliases + (if (and mail-aliases (fboundp 'expand-mail-aliases)) ; XEmacs (expand-mail-aliases (point-min) delimline)) (goto-char (point-min)) ;; ignore any blank lines in the header @@ -173,17 +124,38 @@ This is relative to `smtpmail-queue-dir'.") (< (point) delimline)) (replace-match "\n")) (let ((case-fold-search t)) - ;; We used to process Resent-... headers here, - ;; but it was not done properly, and the job - ;; is done correctly in smtpmail-deduce-address-list. + (goto-char (point-min)) + (goto-char (point-min)) + (while (re-search-forward "^Resent-to:" delimline t) + (setq resend-to-addresses + (save-restriction + (narrow-to-region (point) + (save-excursion + (forward-line 1) + (while (looking-at "^[ \t]") + (forward-line 1)) + (point))) + (append (mail-parse-comma-list) + resend-to-addresses)))) +;;; Apparently this causes a duplicate Sender. +;;; ;; If the From is different than current user, insert Sender. +;;; (goto-char (point-min)) +;;; (and (re-search-forward "^From:" delimline t) +;;; (progn +;;; (require 'mail-utils) +;;; (not (string-equal +;;; (mail-strip-quoted-names +;;; (save-restriction +;;; (narrow-to-region (point-min) delimline) +;;; (mail-fetch-field "From"))) +;;; (user-login-name)))) +;;; (progn +;;; (forward-line 1) +;;; (insert "Sender: " (user-login-name) "\n"))) ;; Don't send out a blank subject line (goto-char (point-min)) - (if (re-search-forward "^Subject:\\([ \t]*\n\\)+\\b" delimline t) - (replace-match "") - ;; This one matches a Subject just before the header delimiter. - (if (and (re-search-forward "^Subject:\\([ \t]*\n\\)+" delimline t) - (= (match-end 0) delimline)) - (replace-match ""))) + (if (re-search-forward "^Subject:[ \t]*\n" delimline t) + (replace-match "")) ;; Put the "From:" field in unless for some odd reason ;; they put one in themselves. (goto-char (point-min)) @@ -246,25 +218,25 @@ This is relative to `smtpmail-queue-dir'.") ;; ;; ;; - (setq smtpmail-address-buffer (generate-new-buffer "*smtp-mail*")) (setq smtpmail-recipient-address-list - (smtpmail-deduce-address-list tembuf (point-min) delimline)) - (kill-buffer smtpmail-address-buffer) - + (or resend-to-addresses + (smtp-deduce-address-list tembuf (point-min) delimline))) + (smtpmail-do-bcc delimline) ; Send or queue (if (not smtpmail-queue-mail) - (if (not (null smtpmail-recipient-address-list)) - (if (not (smtpmail-via-smtp - smtpmail-recipient-address-list tembuf)) + (if smtpmail-recipient-address-list + (if (not (smtp-via-smtp user-mail-address + smtpmail-recipient-address-list + tembuf)) (error "Sending failed; SMTP protocol error")) (error "Sending failed; no recipients")) - (let* ((file-data (concat - smtpmail-queue-dir - (concat (time-stamp-yyyy-mm-dd) - "_" (time-stamp-hh:mm:ss)))) - (file-data (convert-standard-filename file-data)) - (file-elisp (concat file-data ".el")) + (let* ((file-data (convert-standard-filename + (concat + (file-name-as-directory smtpmail-queue-dir) + (time-stamp-yyyy-mm-dd) + "_" (time-stamp-hh:mm:ss)))) + (file-elisp (concat file-data ".el")) (buffer-data (create-file-buffer file-data)) (buffer-elisp (create-file-buffer file-elisp)) (buffer-scratch "*queue-mail*")) @@ -272,7 +244,9 @@ This is relative to `smtpmail-queue-dir'.") (set-buffer buffer-data) (erase-buffer) (insert-buffer tembuf) - (write-file file-data) + (or (file-directory-p smtpmail-queue-dir) + (make-directory smtpmail-queue-dir t)) + (write-region-as-binary (point-min) (point-max) file-data) (set-buffer buffer-elisp) (erase-buffer) (insert (concat @@ -308,10 +282,10 @@ This is relative to `smtpmail-queue-dir'.") (end-of-line) (point)))) (load file-msg) - (setq tembuf (find-file-noselect file-msg)) - (if (not (null smtpmail-recipient-address-list)) - (if (not (smtpmail-via-smtp smtpmail-recipient-address-list - tembuf)) + (setq tembuf (find-file-noselect-as-binary file-msg)) + (if smtpmail-recipient-address-list + (if (not (smtp-via-smtp user-mail-address + smtpmail-recipient-address-list tembuf)) (error "Sending failed; SMTP protocol error")) (error "Sending failed; no recipients")) (delete-file file-msg) @@ -323,397 +297,27 @@ This is relative to `smtpmail-queue-dir'.") (kill-buffer buffer-index) ))) -;(defun smtpmail-via-smtp (host,port,sender,destination,smtpmail-text-buffer) - -(defun smtpmail-fqdn () - (if smtpmail-local-domain - (concat (system-name) "." smtpmail-local-domain) - (system-name))) - -(defun smtpmail-via-smtp (recipient smtpmail-text-buffer) - (let ((process nil) - (host (or smtpmail-smtp-server - (error "`smtpmail-smtp-server' not defined"))) - (port smtpmail-smtp-service) - response-code - greeting - process-buffer - (supported-extensions '())) - (unwind-protect - (catch 'done - ;; get or create the trace buffer - (setq process-buffer - (get-buffer-create (format "*trace of SMTP session to %s*" host))) - - ;; clear the trace buffer of old output - (save-excursion - (set-buffer process-buffer) - (erase-buffer)) - - ;; open the connection to the server - (setq process (open-network-stream "SMTP" process-buffer host port)) - (and (null process) (throw 'done nil)) - - ;; set the send-filter - (set-process-filter process 'smtpmail-process-filter) - - (save-excursion - (set-buffer process-buffer) - (set-buffer-process-coding-system 'raw-text-unix 'raw-text-unix) - (make-local-variable 'smtpmail-read-point) - (setq smtpmail-read-point (point-min)) - - - (if (or (null (car (setq greeting (smtpmail-read-response process)))) - (not (integerp (car greeting))) - (>= (car greeting) 400)) - (throw 'done nil) - ) - - ;; EHLO - (smtpmail-send-command process (format "EHLO %s" (smtpmail-fqdn))) - - (if (or (null (car (setq response-code (smtpmail-read-response process)))) - (not (integerp (car response-code))) - (>= (car response-code) 400)) - (progn - ;; HELO - (smtpmail-send-command process (format "HELO %s" (smtpmail-fqdn))) - - (if (or (null (car (setq response-code (smtpmail-read-response process)))) - (not (integerp (car response-code))) - (>= (car response-code) 400)) - (throw 'done nil))) - (let ((extension-lines (cdr (cdr response-code)))) - (while extension-lines - (let ((name (intern (downcase (car (split-string (substring (car extension-lines) 4) "[ ]")))))) - (and name - (cond ((memq name '(verb xvrb 8bitmime onex xone - expn size dsn etrn - help xusr)) - (setq supported-extensions - (cons name supported-extensions))) - (t (message "unknown extension %s" - name))))) - (setq extension-lines (cdr extension-lines))))) - - (if (or (member 'onex supported-extensions) - (member 'xone supported-extensions)) - (progn - (smtpmail-send-command process (format "ONEX")) - (if (or (null (car (setq response-code (smtpmail-read-response process)))) - (not (integerp (car response-code))) - (>= (car response-code) 400)) - (throw 'done nil)))) - - (if (and smtpmail-debug-info - (or (member 'verb supported-extensions) - (member 'xvrb supported-extensions))) - (progn - (smtpmail-send-command process (format "VERB")) - (if (or (null (car (setq response-code (smtpmail-read-response process)))) - (not (integerp (car response-code))) - (>= (car response-code) 400)) - (throw 'done nil)))) - - (if (member 'xusr supported-extensions) - (progn - (smtpmail-send-command process (format "XUSR")) - (if (or (null (car (setq response-code (smtpmail-read-response process)))) - (not (integerp (car response-code))) - (>= (car response-code) 400)) - (throw 'done nil)))) - - ;; MAIL FROM: - (let ((size-part - (if (member 'size supported-extensions) - (format " SIZE=%d" - (save-excursion - (set-buffer smtpmail-text-buffer) - ;; size estimate: - (+ (- (point-max) (point-min)) - ;; Add one byte for each change-of-line - ;; because or CR-LF representation: - (count-lines (point-min) (point-max)) - ;; For some reason, an empty line is - ;; added to the message. Maybe this - ;; is a bug, but it can't hurt to add - ;; those two bytes anyway: - 2))) - "")) - (body-part - (if (member '8bitmime supported-extensions) - ;; FIXME: - ;; Code should be added here that transforms - ;; the contents of the message buffer into - ;; something the receiving SMTP can handle. - ;; For a receiver that supports 8BITMIME, this - ;; may mean converting BINARY to BASE64, or - ;; adding Content-Transfer-Encoding and the - ;; other MIME headers. The code should also - ;; return an indication of what encoding the - ;; message buffer is now, i.e. ASCII or - ;; 8BITMIME. - (if nil - " BODY=8BITMIME" - "") - ""))) -; (smtpmail-send-command process (format "MAIL FROM:%s@%s" (user-login-name) (smtpmail-fqdn))) - (smtpmail-send-command process (format "MAIL FROM: <%s>%s%s" - user-mail-address - size-part - body-part)) - - (if (or (null (car (setq response-code (smtpmail-read-response process)))) - (not (integerp (car response-code))) - (>= (car response-code) 400)) - (throw 'done nil) - )) - - ;; RCPT TO: - (let ((n 0)) - (while (not (null (nth n recipient))) - (smtpmail-send-command process (format "RCPT TO: <%s>" (maybe-append-domain (nth n recipient)))) - (setq n (1+ n)) - - (setq response-code (smtpmail-read-response process)) - (if (or (null (car response-code)) - (not (integerp (car response-code))) - (>= (car response-code) 400)) - (throw 'done nil) - ) - )) - - ;; DATA - (smtpmail-send-command process "DATA") - - (if (or (null (car (setq response-code (smtpmail-read-response process)))) - (not (integerp (car response-code))) - (>= (car response-code) 400)) - (throw 'done nil) - ) - - ;; Mail contents - (smtpmail-send-data process smtpmail-text-buffer) - - ;;DATA end "." - (smtpmail-send-command process ".") - - (if (or (null (car (setq response-code (smtpmail-read-response process)))) - (not (integerp (car response-code))) - (>= (car response-code) 400)) - (throw 'done nil) - ) - - ;;QUIT -; (smtpmail-send-command process "QUIT") -; (and (null (car (smtpmail-read-response process))) -; (throw 'done nil)) - t )) - (if process - (save-excursion - (set-buffer (process-buffer process)) - (smtpmail-send-command process "QUIT") - (smtpmail-read-response process) - -; (if (or (null (car (setq response-code (smtpmail-read-response process)))) -; (not (integerp (car response-code))) -; (>= (car response-code) 400)) -; (throw 'done nil) -; ) - (delete-process process)))))) - - -(defun smtpmail-process-filter (process output) - (save-excursion - (set-buffer (process-buffer process)) - (goto-char (point-max)) - (insert output))) - -(defun smtpmail-read-response (process) - (let ((case-fold-search nil) - (response-strings nil) - (response-continue t) - (return-value '(nil ())) - match-end) - - (while response-continue - (goto-char smtpmail-read-point) - (while (not (search-forward "\r\n" nil t)) - (accept-process-output process) - (goto-char smtpmail-read-point)) - - (setq match-end (point)) - (setq response-strings - (cons (buffer-substring smtpmail-read-point (- match-end 2)) - response-strings)) - - (goto-char smtpmail-read-point) - (if (looking-at "[0-9]+ ") - (let ((begin (match-beginning 0)) - (end (match-end 0))) - (if smtpmail-debug-info - (message "%s" (car response-strings))) - - (setq smtpmail-read-point match-end) - - ;; ignore lines that start with "0" - (if (looking-at "0[0-9]+ ") - nil - (setq response-continue nil) - (setq return-value - (cons (string-to-int - (buffer-substring begin end)) - (nreverse response-strings))))) - - (if (looking-at "[0-9]+-") - (progn (if smtpmail-debug-info - (message "%s" (car response-strings))) - (setq smtpmail-read-point match-end) - (setq response-continue t)) - (progn - (setq smtpmail-read-point match-end) - (setq response-continue nil) - (setq return-value - (cons nil (nreverse response-strings))) - ) - ))) - (setq smtpmail-read-point match-end) - return-value)) - - -(defun smtpmail-send-command (process command) - (goto-char (point-max)) - (if (= (aref command 0) ?P) - (insert "PASS \r\n") - (insert command "\r\n")) - (setq smtpmail-read-point (point)) - (process-send-string process command) - (process-send-string process "\r\n")) - -(defun smtpmail-send-data-1 (process data) - (goto-char (point-max)) - - (if (and (multibyte-string-p data) - smtpmail-code-conv-from) - (setq data (string-as-multibyte - (encode-coding-string data smtpmail-code-conv-from)))) - - (if smtpmail-debug-info - (insert data "\r\n")) - - (setq smtpmail-read-point (point)) - ;; Escape "." at start of a line - (if (eq (string-to-char data) ?.) - (process-send-string process ".")) - (process-send-string process data) - (process-send-string process "\r\n") - ) - -(defun smtpmail-send-data (process buffer) - (let - ((data-continue t) - (sending-data nil) - this-line - this-line-end) - - (save-excursion - (set-buffer buffer) - (goto-char (point-min))) - - (while data-continue - (save-excursion - (set-buffer buffer) - (beginning-of-line) - (setq this-line (point)) - (end-of-line) - (setq this-line-end (point)) - (setq sending-data nil) - (setq sending-data (buffer-substring this-line this-line-end)) - (if (/= (forward-line 1) 0) - (setq data-continue nil))) - - (smtpmail-send-data-1 process sending-data) - ) - ) - ) - - -(defun smtpmail-deduce-address-list (smtpmail-text-buffer header-start header-end) - "Get address list suitable for smtp RCPT TO:
." - (require 'mail-utils) ;; pick up mail-strip-quoted-names - - (unwind-protect - (save-excursion - (set-buffer smtpmail-address-buffer) (erase-buffer) - (let - ((case-fold-search t) - (simple-address-list "") - this-line - this-line-end - addr-regexp) - (insert-buffer-substring smtpmail-text-buffer header-start header-end) - (goto-char (point-min)) - ;; RESENT-* fields should stop processing of regular fields. - (save-excursion - (if (re-search-forward "^Resent-\\(to\\|cc\\|bcc\\):" header-end t) - (setq addr-regexp "^Resent-\\(to\\|cc\\|bcc\\):") - (setq addr-regexp "^\\(To:\\|Cc:\\|Bcc:\\)"))) - - (while (re-search-forward addr-regexp header-end t) - (replace-match "") - (setq this-line (match-beginning 0)) - (forward-line 1) - ;; get any continuation lines - (while (and (looking-at "^[ \t]+") (< (point) header-end)) - (forward-line 1)) - (setq this-line-end (point-marker)) - (setq simple-address-list - (concat simple-address-list " " - (mail-strip-quoted-names (buffer-substring this-line this-line-end)))) - ) - (erase-buffer) - (insert-string " ") - (insert-string simple-address-list) - (insert-string "\n") - (subst-char-in-region (point-min) (point-max) 10 ? t);; newline --> blank - (subst-char-in-region (point-min) (point-max) ?, ? t);; comma --> blank - (subst-char-in-region (point-min) (point-max) 9 ? t);; tab --> blank - - (goto-char (point-min)) - ;; tidyness in case hook is not robust when it looks at this - (while (re-search-forward "[ \t]+" header-end t) (replace-match " ")) - - (goto-char (point-min)) - (let (recipient-address-list) - (while (re-search-forward " \\([^ ]+\\) " (point-max) t) - (backward-char 1) - (setq recipient-address-list (cons (buffer-substring (match-beginning 1) (match-end 1)) - recipient-address-list)) - ) - (setq smtpmail-recipient-address-list recipient-address-list)) - - ) - ) - ) - ) - (defun smtpmail-do-bcc (header-end) - "Delete [Resent-]BCC: and their continuation lines from the header area. + "Delete BCC: and their continuation lines from the header area. There may be multiple BCC: lines, and each may have arbitrarily many continuation lines." (let ((case-fold-search t)) (save-excursion (goto-char (point-min)) ;; iterate over all BCC: lines - (while (re-search-forward "^\\(RESENT-\\)?BCC:" header-end t) - (delete-region (match-beginning 0) - (progn (forward-line 1) (point))) + (while (re-search-forward "^BCC:" header-end t) + (delete-region (match-beginning 0) (progn (forward-line 1) (point))) ;; get rid of any continuation lines (while (and (looking-at "^[ \t].*\n") (< (point) header-end)) - (replace-match "")))))) + (replace-match "")) + ) + ) ;; save-excursion + ) ;; let + ) + +;;; (provide 'smtpmail)