From 4effb112160584e65a2d87f9f9838a052187cc0a Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Sun, 17 Jul 2005 07:43:29 +0000 Subject: [PATCH] (smtpmail-auth-supported): Added the 'plain auth method (smtpmail-try-auth-methods): added the AUTH PLAIN dialog --- lisp/ChangeLog | 6 ++++++ lisp/mail/smtpmail.el | 22 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c91ec623ed3..31a034e54e9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2005-07-16 Jose E. Marchesi + + * lisp/mail/smtpmail.el (smtpmail-auth-supported): Added the + 'plain auth method + (smtpmail-try-auth-methods): added the AUTH PLAIN dialog + 2005-07-17 Kim F. Storm * ido.el (dired-other-window): Add ido property. diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 0c076011044..480062286e0 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -1,6 +1,6 @@ ;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail -;; Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004 +;; Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004, 2005 ;; Free Software Foundation, Inc. ;; Author: Tomoji Kagatani @@ -207,7 +207,7 @@ This is relative to `smtpmail-queue-dir'.") (defvar smtpmail-queue-index (concat smtpmail-queue-dir smtpmail-queue-index-file)) -(defconst smtpmail-auth-supported '(cram-md5 login) +(defconst smtpmail-auth-supported '(cram-md5 login plain) "List of supported SMTP AUTH mechanisms.") ;;; @@ -559,8 +559,24 @@ This is relative to `smtpmail-queue-dir'.") (not (integerp (car ret))) (>= (car ret) 400)) (throw 'done nil))) + ((eq mech 'plain) + (smtpmail-send-command process "AUTH PLAIN") + (if (or (null (car (setq ret (smtpmail-read-response process)))) + (not (integerp (car ret))) + (not (equal (car ret) 334))) + (throw 'done nil)) + (smtpmail-send-command process (base64-encode-string + (concat "\0" + (smtpmail-cred-user cred) + "\0" + (smtpmail-cred-passwd cred)))) + (if (or (null (car (setq ret (smtpmail-read-response process)))) + (not (integerp (car ret))) + (not (equal (car ret) 235))) + (throw 'done nil))) + (t - (error "Mechanism %s not implemented" mech))) + (error "Mechanism %s not implemented" mech))) ;; Remember the password. (when (and (not (stringp smtpmail-auth-credentials)) (null (smtpmail-cred-passwd cred))) -- 2.39.2