From: yamaoka Date: Wed, 13 Nov 2002 00:30:37 +0000 (+0000) Subject: Partially synch with the flim-1_14 branch. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02ba135a7634a0102daac1656493ddfc649c15ce;p=elisp%2Fflim.git Partially synch with the flim-1_14 branch. --- diff --git a/ChangeLog b/ChangeLog index 2928d8b..d86ccf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2002-07-26 Katsumi Yamaoka + + * smtp.el (smtp-open-connection-function): Add doc. + (smtp-end-of-line): Doc fix. + +2002-07-24 Katsumi Yamaoka + + * smtp.el (smtp-end-of-line): New variable. + (smtp-read-response): Use it. + (smtp-send-command): Use it. + (smtp-send-data): Use it. + +2001-07-30 AMAKAWA Shuhei + + * smtp.el (smtp-submit-package): Send EHLO after starttls. + 2001-05-21 SHIMADA Mitsunobu * LIMIT: CVS commit diff --git a/smtp.el b/smtp.el index 4265bbd..9eca1f8 100644 --- a/smtp.el +++ b/smtp.el @@ -27,7 +27,7 @@ ;;; Commentary: -;; +;; ;;; Code: @@ -61,7 +61,7 @@ called from `smtp-via-smtp' with arguments SENDER and RECIPIENTS." (defcustom smtp-service "smtp" "SMTP service port number. \"smtp\" or 25." :type '(choice (integer :tag "25" 25) - (string :tag "smtp" "smtp")) + (string :tag "smtp" "smtp")) :group 'smtp) (defcustom smtp-local-domain nil @@ -114,7 +114,23 @@ don't define this value." (defvar sasl-mechanisms) ;;;###autoload -(defvar smtp-open-connection-function #'open-network-stream) +(defvar smtp-open-connection-function #'open-network-stream + "*Function used for connecting to a SMTP server. +The function will be called with the same four arguments as +`open-network-stream' and should return a process object. +Here is an example: + +\(setq smtp-open-connection-function + #'(lambda (name buffer host service) + (let ((process-connection-type nil)) + (start-process name buffer \"ssh\" \"-C\" host + \"nc\" host service)))) + +It connects to a SMTP server using \"ssh\" before actually connecting +to the SMTP port. Where the command \"nc\" is the netcat executable; +see http://www.atstake.com/research/tools/index.html#network_utilities +for details. In addition, you will have to modify the value for +`smtp-end-of-line' to \"\\n\" if you use \"telnet\" instead of \"nc\".") (defvar smtp-read-point nil) @@ -122,6 +138,11 @@ don't define this value." (defvar smtp-submit-package-function #'smtp-submit-package) +(defvar smtp-end-of-line "\r\n" + "*String to use as end-of-line marker when talking to a SMTP server. +This is \"\\r\\n\" by default, but it may have to be \"\\n\" when using a non +native connection function. See also `smtp-open-connection-function'.") + ;;; @ SMTP package ;;; A package contains a mail message, an envelope sender address, ;;; and one or more envelope recipient addresses. In ESMTP model @@ -295,7 +316,9 @@ BUFFER may be a buffer or a buffer name which contains mail message." (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) @@ -500,13 +523,13 @@ BUFFER may be a buffer or a buffer name which contains mail message." response) (while response-continue (goto-char smtp-read-point) - (while (not (search-forward "\r\n" nil t)) + (while (not (search-forward smtp-end-of-line nil t)) (accept-process-output (smtp-connection-process-internal connection)) (goto-char smtp-read-point)) (if decoder (let ((string (buffer-substring smtp-read-point (- (point) 2)))) (delete-region smtp-read-point (point)) - (insert (funcall decoder string) "\r\n"))) + (insert (funcall decoder string) smtp-end-of-line))) (setq response (nconc response (list (buffer-substring @@ -528,7 +551,7 @@ BUFFER may be a buffer or a buffer name which contains mail message." (smtp-connection-encoder-internal connection))) (set-buffer (process-buffer process)) (goto-char (point-max)) - (setq command (concat command "\r\n")) + (setq command (concat command smtp-end-of-line)) (insert command) (setq smtp-read-point (point)) (if encoder @@ -542,8 +565,8 @@ BUFFER may be a buffer or a buffer name which contains mail message." (smtp-connection-encoder-internal connection))) ;; Escape "." at start of a line. (if (eq (string-to-char data) ?.) - (setq data (concat "." data "\r\n")) - (setq data (concat data "\r\n"))) + (setq data (concat "." data smtp-end-of-line)) + (setq data (concat data smtp-end-of-line))) (if encoder (setq data (funcall encoder data))) (process-send-string process data)))