-;;; smtp.el --- basic functions of SMTP protocol (RFC 821)
+;;; smtp.el --- basic functions to send mail with SMTP server
;; Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
:type 'boolean
:group 'smtp)
-(defcustom smtp-coding-system 'binary
- "*Coding-system for SMTP output."
- :type 'coding-system
- :group 'smtp)
-
(defun smtp-fqdn ()
(if smtp-local-domain
response-code
greeting
process-buffer
- (supported-extensions '())
- (coding-system-for-read smtp-coding-system)
- (coding-system-for-write smtp-coding-system))
+ (supported-extensions '()))
(unwind-protect
(catch 'done
;; get or create the trace buffer
(erase-buffer))
;; open the connection to the server
- (setq process (open-network-stream "SMTP" process-buffer host port))
+ (setq process (open-network-stream-as-binary
+ "SMTP" process-buffer host port))
(and (null process) (throw 'done nil))
;; set the send-filter
(setq this-line-end (point))
(setq sending-data nil)
(setq sending-data (buffer-substring this-line this-line-end))
- (if (/= (forward-line 1) 0)
+ (if (or (/= (forward-line 1) 0) (eobp))
(setq data-continue nil)))
(smtp-send-data-1 process sending-data)
(simple-address-list "")
this-line
this-line-end
- addr-regexp)
-
+ addr-regexp
+ (smtp-address-buffer (generate-new-buffer " *smtp-mail*")))
(unwind-protect
(save-excursion
;;
- (set-buffer smtp-address-buffer) (erase-buffer)
+ (set-buffer smtp-address-buffer)
+ (erase-buffer)
(insert-buffer-substring smtp-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:" header-end t)
- (setq addr-regexp "^\\(RESENT-TO:\\|RESENT-CC:\\|RESENT-BCC:\\)")
+ (setq addr-regexp
+ "^\\(RESENT-TO:\\|RESENT-CC:\\|RESENT-BCC:\\)")
(setq addr-regexp "^\\(TO:\\|CC:\\|BCC:\\)")))
(while (re-search-forward addr-regexp header-end t)
(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))))
+ (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
+ ;; newline --> blank
+ (subst-char-in-region (point-min) (point-max) 10 ? t)
+ ;; comma --> blank
+ (subst-char-in-region (point-min) (point-max) ?, ? t)
+ ;; tab --> blank
+ (subst-char-in-region (point-min) (point-max) 9 ? t)
(goto-char (point-min))
;; tidyness in case hook is not robust when it looks at this
(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 recipient-address-list
+ (cons (buffer-substring (match-beginning 1) (match-end 1))
+ recipient-address-list))
)
- (setq smtp-recipient-address-list recipient-address-list))
-
+ recipient-address-list)
)
- )
- )
- )
+ (kill-buffer smtp-address-buffer))
+ ))
(defun smtp-do-bcc (header-end)
"Delete BCC: and their continuation lines from the header area.