(std11-lexical-analyze): Change interface to add new optional argument
[elisp/flim.git] / smtpmail.el
index 77a5947..807b4a7 100644 (file)
@@ -1,23 +1,21 @@
-;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail
+;;; smtpmail.el --- SMTP interface for mail-mode
 
-;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
 
 ;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp>
-;; Maintainer: Brian D. Carlstrom <bdc@ai.mit.edu>
-;; ESMTP support: Simon Leinen <simon@switch.ch>
 ;; 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
@@ -76,6 +74,7 @@ This is relative to `smtpmail-queue-dir'.")
 ;;;
 ;;;
 
+;;;###autoload
 (defun smtpmail-send-it ()
   (require 'mail-utils)
   (let ((errbuf (if mail-interactive
@@ -207,12 +206,13 @@ This is relative to `smtpmail-queue-dir'.")
                (or resend-to-addresses
                    (smtp-deduce-address-list tembuf (point-min) delimline)))
 
-         (smtp-do-bcc delimline)
+         (smtpmail-do-bcc delimline)
          ; Send or queue
          (if (not smtpmail-queue-mail)
              (if smtpmail-recipient-address-list
-                 (if (not (smtp-via-smtp
-                           smtpmail-recipient-address-list tembuf))
+                 (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 
@@ -265,7 +265,8 @@ This is relative to `smtpmail-queue-dir'.")
        (load file-msg)
        (setq tembuf (find-file-noselect file-msg))
        (if smtpmail-recipient-address-list
-           (if (not (smtp-via-smtp smtpmail-recipient-address-list tembuf))
+           (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)
@@ -278,6 +279,25 @@ This is relative to `smtpmail-queue-dir'.")
       )))
 
 
+(defun smtpmail-do-bcc (header-end)
+  "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 "^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 ""))
+       )
+      ) ;; save-excursion
+    ) ;; let
+  )
+
+
 ;;;
 
 (provide 'smtpmail)