;;; smtp.el --- basic functions to send mail with SMTP server
-;; Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp>
;; Simon Leinen <simon@switch.ch> (ESMTP support)
;;; Code:
-(require 'pces)
(require 'custom)
(require 'mail-utils) ; mail-strip-quoted-names
(require 'sasl)
(require 'luna)
+(require 'mel) ; binary-funcall
(defgroup smtp nil
"SMTP protocol for sending mail."
:group 'smtp-extensions)
(defvar sasl-mechanisms)
-
+
+;;;###autoload
(defvar smtp-open-connection-function #'open-network-stream)
(defvar smtp-read-point nil)
Return a newly allocated connection-object.
BUFFER is the buffer to associate with the connection. SERVER is name
of the host to connect to. SERVICE is name of the service desired."
- (let* ((coding-system-for-read 'binary)
- (coding-system-for-write 'binary)
- (process
- (funcall smtp-open-connection-function
- "SMTP" buffer server service))
- connection)
+ (let ((process
+ (binary-funcall smtp-open-connection-function
+ "SMTP" buffer server service))
+ connection)
(when process
(setq connection (smtp-make-connection process server service))
(set-process-filter process 'smtp-process-filter)
;;;###autoload
(defun smtp-via-smtp (sender recipients buffer)
+ "Like `smtp-send-buffer', but sucks in any errors."
(condition-case nil
(progn
(smtp-send-buffer sender recipients buffer)
;;;###autoload
(defun smtp-send-buffer (sender recipients buffer)
+ "Send a message.
+SENDER is an envelope sender address.
+RECIPIENTS is a list of envelope recipient addresses.
+BUFFER may be a buffer or a buffer name which contains mail message."
(let ((server
(if (functionp smtp-server)
(funcall smtp-server sender recipients)
(smtp-response-error
(smtp-primitive-helo package)))
(if smtp-use-starttls
- (smtp-primitive-starttls package))
+ (progn
+ (smtp-primitive-starttls package)
+ (smtp-primitive-ehlo package)))
(if smtp-use-sasl
(smtp-primitive-auth package))
(smtp-primitive-mailfrom package)